void FixedUpdate() { // Every 1 second // Get new villager list and check it for status and current resource task if (Time.fixedTime >= timeToUpdate) { if (villagers != null && villagers.Count > 0) { villagers = GameObject.Find("VillagerSpawner").GetComponent <SpawnVillagers>().getVillagerList(); lastListLength = villagers.Count; int index; string task, status; foreach (GameObject villager in villagers) { TownFolkAI script = villager.GetComponent <TownFolkAI>(); index = villagers.IndexOf(villager); int tableID = index + 1; task = script.lastResource; status = script.state; villTasks[index].text = task; villStatuses[index].text = status; } } // update every 1 second timeToUpdate = Time.fixedTime + 1.0f; } //foreach(GameObject line in villInfoLines) //{ // // make the object invisible somehow //} }
public MoveState(TownFolkAI owner) { this.owner = owner; }
public WaitState(TownFolkAI owner) { this.owner = owner; }
public FleeState(TownFolkAI owner) { this.owner = owner; }
public SearchState(TownFolkAI owner) { this.owner = owner; }
public GatherState(TownFolkAI owner) { this.owner = owner; }