Ejemplo n.º 1
0
    private void Tired()
    {
        agentResources.DecreaseStamina();
        if (agentResources.Stamina == 0)
        {
            AgentsDeathsHandler deathsHandler = transform.parent.gameObject.GetComponent("AgentsDeathsHandler") as AgentsDeathsHandler;
            deathsHandler.AgentStaved((agentsManager.GetComponent("TimeDistribution") as TimeDistribution).DaysPassed - dateBorn);

            KillItself();
        }
    }
Ejemplo n.º 2
0
    private void UpdateStamina()
    {
        if (Time.time >= nextStaminaUpdate)
        {
            nextStaminaUpdate = Mathf.FloorToInt(Time.time) + staminaUpdateTime;             // Change the next update (current second+1)
            agentBehaviours.GetHungrier();
        }

        if (agentBehaviours.IsFull())
        {
            agentBehaviours.BecomeFull();
        }
        else if (agentBehaviours.HasStaminaToProcreate())
        {
            agentBehaviours.BecomeAbleToProcreate();
        }
        else if (agentBehaviours.IsHungry())
        {
            agentBehaviours.BecomeHungry();
        }
        else if (agentBehaviours.IsStarving())
        {
            agentBehaviours.BecomeStarving();
        }
        else if (agentBehaviours.IsDead())
        {
            AgentsDeathsHandler deathsHandler = transform.parent.gameObject.GetComponent("AgentsDeathsHandler") as AgentsDeathsHandler;
            deathsHandler.AgentStaved(timeDistribution.DaysPassed - dateBorn);

            KillItself();
        }
        else
        {
            agentBehaviours.BecomeUnableToProcreate();
        }
    }