public override void Perform() { if (GameController.players[owner].ownedUnitCount < 5) { hut.Perform(); } sink.Perform(); storage.DepositRecource(sink); storage.Perform(); // Gain a unit if (storage.resources[0] >= 100) { hut.Perform(); storage.resources[0] -= 100; } }
public override void Init() { hut = GetComponent <Hut>(); storage = GetComponent <Storage>(); sink = GetComponent <ResourceSink>(); hut.health = storage.health = sink.health = health; hut.owner = storage.owner = sink.owner = owner; hut.refreshPerformTime = storage.refreshPerformTime = sink.refreshPerformTime = refreshPerformTime; hut.Init(); // Spawn in starting units for (int i = 0; i < 5; i++) { hut.Perform(); } StartTask(); }