IEnumerator Movement() { while (true) { yield return(new WaitForSeconds(1)); if (state == State.Stopped) { VillageController c = VillageController.controller; target = c.GetRandomBuilding(); start = c.GetNodeFromWorldPos(transform.position); end = c.GetNodeFromWorldPos(target.GO.transform.position); List <Node> path = c.GeneratePath(start, end); if (path != null) { MoveTo(path); } } } }
private void Awake() { controller = this; }
private void Awake() { _controller = GetComponent <VillageController>(); TimeManager.onDayStart += UpdateSize; }