private void setEnergy() { if (user.GetComponent("UtilityStates") != null) { Debug.Log("Eating"); target = user.GetComponent <UtilityStates>(); target.healEnergy(energyHealInternal); } }
//private void OnTriggerStay2D(Collider2D other) //{ // if (other.gameObject.tag.Contains("AI")) // { // if (occupied) // { // UtilityStates temp = other.GetComponent<UtilityStates>(); // temp.NodeOccupied = true; // } // } //} private void setThirst() { if (user.GetComponent("UtilityStates") != null) { Debug.Log("Drinking"); target = user.GetComponent <UtilityStates>(); target.healThirst(thirstHealInternal); } }
void Start() { AIController.Death += Nest_OwnerDeath; prefab = Resources.Load <GameObject>("Prey AI"); nestOwner = Instantiate(prefab, gameObject.transform); nestOwnerStates = nestOwner.GetComponent <UtilityStates>(); nestOwnerStates.HungerRate = HungerRate; nestOwnerStates.ThirstRate = ThirstRate; nestOwnerStates.TirednessRate = TirednessRate; ownerAlive = true; internalClock = respawnTime; respawning = false; }
void Start() { SetUpKeywords(); FindBestFoodKeyword(); waterLoc = new List <Vector2>(); foodLoc = new List <Vector2>(); restLoc = new List <Vector2>(); target = GetComponent <AIDestinationSetter>(); utilityStates = GetComponent <UtilityStates>(); AddWater(); AddFood(); AddRest(); }
private void OnTriggerExit2D(Collider2D other) { if (other.gameObject.tag.Contains("AI")) { UtilityStates temp = other.GetComponent <UtilityStates>(); if (other == user) { user = null; active = false; occupied = false; temp.oblivious = false; } } }
void Update() { if (respawning) { internalClock -= Time.deltaTime; } if (!ownerAlive && internalClock <= 0) { nestOwner = Instantiate(prefab, gameObject.transform); nestOwnerStates = nestOwner.GetComponent <UtilityStates>(); nestOwnerStates.HungerRate = HungerRate; nestOwnerStates.ThirstRate = ThirstRate; nestOwnerStates.TirednessRate = TirednessRate; ownerAlive = true; respawning = false; internalClock = respawnTime; } }
private void OnTriggerEnter2D(Collider2D other) { if (other.gameObject.tag.Contains("AI")) { UtilityStates temp = other.GetComponent <UtilityStates>(); if (occupied == false) { user = other; active = true; occupied = true; temp.oblivious = true; temp.NodeOccupied = false; } else if (occupied == true) { temp.NodeOccupied = true; } } }