public void AddVillagerView(Villager villager, int index) { VillagerView villagerView = Instantiate(m_VillagerViewPrefab, Content).GetComponent <VillagerView>(); villagerView.SetStats((int)villager.WoodProduction, (int)villager.FoodProduction, (int)villager.FaithProduction); villagerView.Index = index; villagerView.OnActionButton += (i) => { Sacrifice(villager); }; }
private void Awake() { _villagerModel = GetComponent <VillagerModel>(); _villagerNeeds = GetComponent <VillagerNeedsController>(); _villagerView = GetComponent <VillagerView>(); _villagerController = GetComponent <VillagerController>(); _townController = TownController.Instance; _spawnController = SpawnController.Instance; }
public void AddVillagerView(Villager villager) { m_Count++; VillagerView villagerView = Instantiate(m_VillagerViewPrefab, Content).GetComponent <VillagerView>(); villagerView.SetStats((int)villager.WoodProduction, (int)villager.FoodProduction, (int)villager.FaithProduction); villagerView.OnActionButton += (i) => { Recruit(villager); }; if (m_RecruitCount == 0) { villagerView.DisableActionButton(); } }