/// <summary> /// Initialize necessary variables and get needed Unity components. Then Register the Villager. /// </summary> protected override void Awake() { base.Awake(); CreatureStats = new VillagerStats(this, transform.Find("HereticIndicator")); m_Sun = FindObjectOfType <AutoIntensity>().GetComponent <Light>(); RegisterVillager(); }
// Init private void Awake() { animator = gameObject.GetComponent <Animator>(); spriteRenderer = gameObject.GetComponent <SpriteRenderer>(); stats = gameObject.GetComponent <VillagerStats>(); progressBarObject = gameObject.transform.GetChild(1).gameObject; progressBar = progressBarObject.GetComponent <ProgressBar>(); mover = gameObject.GetComponent <VillagerMover>(); }
public GameObject getCharacterById(int id) { List <GameObject> people = getAllVillagerObjects(); for (int i = 0; i < people.Count; i++) { VillagerStats stats = people[i].GetComponent <VillagerStats>(); if (stats.id == id) { return(people[i]); } } Debug.LogError("NO PERSON OF THIS ID FOUND"); return(people[0]); }
public void selectVillagerById(int id) { unselectAllBuildings(); List <GameObject> people = getAllVillagerObjects(); for (int i = 0; i < people.Count; i++) { VillagerStats stats = people[i].GetComponent <VillagerStats>(); if (stats.id == id) { stats.setSelected(true); return; } } }
// Init private void Awake() { villagerStats = gameObject.GetComponent <VillagerStats>(); gather = gameObject.GetComponent <VillagerGather>(); }
// Init private void Awake() { animator = gameObject.GetComponent <Animator>(); stats = gameObject.GetComponent <VillagerStats>(); gatherScript = gameObject.GetComponent <VillagerGather>(); }