Example #1
0
 private void setEnergy()
 {
     if (user.GetComponent("UtilityStates") != null)
     {
         Debug.Log("Eating");
         target = user.GetComponent <UtilityStates>();
         target.healEnergy(energyHealInternal);
     }
 }
Example #2
0
    //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);
        }
    }
Example #3
0
 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;
 }
Example #4
0
 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();
 }
Example #5
0
 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;
         }
     }
 }
Example #6
0
        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;
            }
        }
Example #7
0
    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;
            }
        }
    }