Finish production line logic
This commit is contained in:
@@ -6,17 +6,32 @@ using UnityEngine;
|
||||
public class Mine : MonoBehaviour
|
||||
{
|
||||
public Resource resource;
|
||||
private GameManager gameManager;
|
||||
private GameManager gameManager;
|
||||
|
||||
private float nextTick = 0f;
|
||||
private AssignableWorker assignableWorker;
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
gameManager = GameObject.Find("GameManager").GetComponent<GameManager>();
|
||||
assignableWorker = gameObject.GetComponent<AssignableWorker>();
|
||||
}
|
||||
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
nextTick -= Time.deltaTime;
|
||||
if (nextTick <= 0f)
|
||||
{
|
||||
Tick();
|
||||
nextTick = 1f;
|
||||
}
|
||||
}
|
||||
|
||||
private void Tick()
|
||||
{
|
||||
gameManager.AddResource(resource, 1 * assignableWorker.GetAssignedWorkers());
|
||||
}
|
||||
|
||||
private void OnMouseDown()
|
||||
|
||||
Reference in New Issue
Block a user