void ClickOnObject() { RaycastHit hit; Ray ray = GetComponent <Camera>().ScreenPointToRay(Input.mousePosition); if (Physics.Raycast(ray, out hit, Mathf.Infinity)) { IAmCreature _creature = hit.transform.GetComponent <IAmCreature>(); if (_creature != null) { CreatureStatus _stats = hit.transform.GetComponent <CreatureStatus>(); BiomeMemory _curBiome = hit.transform.GetComponent <CreatureMemory>().CurBiome; IHavePrefTemperature _tempStats = hit.transform.GetComponent <IHavePrefTemperature>(); if (_stats != null) { _statsUI.UpdateStatUI(_stats, _curBiome, _tempStats); } _motor.SetFollowTarget(hit.transform); } } }
public void CheckDetectedCreature(Transform _creature, bool _add) { if (_creature.gameObject == transform.root.gameObject) { return; } IAmCreature _ICreature = transform.parent.GetComponent <IAmCreature>(); if (_ICreature != null) { if (myBiology != null) { //NEED TO CHECK FOODCHAIN RANK HERE if (myBiology.dietType == Biology.DietType.Carnivore) { CarnivoreCreatureCheck(_creature, _add); } else if (myBiology.dietType == Biology.DietType.Herbivore) { IAmPlant plantType = _creature.GetComponent <IAmPlant>(); if (plantType != null) { IPrefPlantType myPrefPlant = transform.parent.GetComponent <IPrefPlantType>(); if (myPrefPlant != null) { if (myPrefPlant.PrefPlant == plantType.PlantType) { if (_add) { //Add To Primary List _memory.primaryPotentialPrey.Add(_creature); } else { _memory.primaryPotentialPrey.Remove(_creature); if (_memory.lastSeenPreyLocations.Count < _memory.maxPreyLocations) { _memory.lastSeenPreyLocations.Add(_creature.position); } else { _memory.lastSeenPreyLocations.RemoveAt(0); _memory.lastSeenPreyLocations.Add(_creature.position); } } } else { if (_add) { //Add To Secondary List _memory.secondaryPotentialPrey.Add(_creature); } else { _memory.secondaryPotentialPrey.Remove(_creature); if (_memory.lastSeenPreyLocations.Count < _memory.maxPreyLocations) { _memory.lastSeenPreyLocations.Add(_creature.position); } else { _memory.lastSeenPreyLocations.RemoveAt(0); _memory.lastSeenPreyLocations.Add(_creature.position); } } } } } } } } }