public void FindAnimal(AnimalConfig animal) { activeAnimal = animal; scannerPanel.SetActive(true); foundPanel.SetActive(false); notfoundPanel.SetActive(false); CheckInRegions(animal.Regions, OnGpsFinderReturned); }
public void LoadConfig(AnimalConfig[] inAnimals) { animals = inAnimals; for (int i = 1; i <= animals.Length; i += 2) { AnimalConfig animal1 = animals[i - 1]; AnimalConfig animal2 = (i < animals.Length ? animals[i] : null); // Create a column GameObject nextGameObject = Instantiate(columnPrefab); nextGameObject.transform.SetParent(columnContainer.transform, false); ChooserColumn nextEntry = nextGameObject.GetComponent <ChooserColumn>(); nextEntry.SetContents(animal1, animal2, this); } }
public void OnAnimalClick(string animal) { AnimalConfig lookingFor = null; foreach (AnimalConfig next in animals) { if (next.Title == animal) { lookingFor = next; break; } } UnityEngine.Debug.Log(animal + " clicked."); if (!animalViewOpen && (lookingFor != null)) { animalViewOpen = true; animalView.gameObject.SetActive(true); animalView.FindAnimal(lookingFor); } }
public void SetContents(AnimalConfig animal1, AnimalConfig animal2, AnimalChooser chooser) { topTile.Name = animal1.Title; if (animal1.ResourceName != "") { topTile.Image = animal1.ResourceName; } topTile.Chooser = chooser; if (animal2 != null) { bottomTile.Name = animal2.Title; if (animal2.ResourceName != "") { bottomTile.Image = animal2.ResourceName; } bottomTile.Chooser = chooser; } else { bottomTile.gameObject.SetActive(false); } }
private void Awake() { entity = GetComponent <BaseEntity>(); npc = entity.GetComponent <BaseNpc>(); npc.CancelInvoke(npc.TickAi); npc.SetAiFlag(BaseNpc.AiFlags.Sleeping, false); animalConfig = GetAnimalSpeed(npc); npc._maxHealth = animalConfig.health; npc.health = animalConfig.health; instance.animalAI[entity] = this; type = animalConfig.agressive ? AType.Aggressive : AType.Passive; originalType = type; state = AIState.Walking; lastPosition = entity.transform.position; InvokeHandler.InvokeRepeating(this, UpdateAI, 0, updateRate); if (IsStucked()) { DestroyAndKill(); } if (config.SleepAtNight) { InvokeHandler.InvokeRepeating(this, CheckTime, updateRate, 10 + updateRate); } }