Ejemplo n.º 1
0
    public void ExecuteState()
    {
        if (StatesUtils.ValidateState(Owner, HUNGRY))
        {
            StatesUtils.MoveTo(Owner, Owner.ChosenFoodPlace.gameObject);

            if (Owner.ChosenFoodPlace.FeedingVacancy == false || Owner.ChosenFoodPlace.FoodValue < 2f)
            {
                if (Owner.AgentMemory.FoodPlaces.Count - 1 > _dicIndex)
                {
                    Owner.ChosenFoodPlace = Owner.AgentMemory.FoodPlaces.ElementAt(_dicIndex).Key;

                    StatesUtils.MoveTo(Owner, Owner.ChosenFoodPlace.gameObject);
                }
                else
                {
                    // Set Work Need to Zero
                    // Cuases the agent to find the next most urgent need
                    Owner.NeedsManager.FoodNeedOverride = true;

                    Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.BaseState]);
                }

                _dicIndex++;
            }
        }

        else
        {
            Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.BaseState]);
        }
    }
Ejemplo n.º 2
0
    public void ExecuteState()
    {
        if (StatesUtils.ValidateState(Owner, WORK))
        {
            StatesUtils.MoveTo(Owner, Owner.CurrentWorkplace.gameObject);

            if (Owner.CurrentWorkplace.WorkersNeeded == false || Owner.CurrentWorkplace.BuildingActive == false)
            {
                _dicIndex++;

                if (Owner.AgentMemory.Workplaces.Count - 1 > _dicIndex)
                {
                    Owner.CurrentWorkplace = Owner.AgentMemory.Workplaces.ElementAt(_dicIndex).Key;

                    StatesUtils.MoveTo(Owner, Owner.CurrentWorkplace.gameObject);
                }
                else
                {
                    // Set Work Need to Zero
                    // Cuases the agent to find the next most urgent need
                    Owner.NeedsManager.WorkNeedOverride = true;

                    Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.BaseState]);
                }
            }
        }

        else
        {
            Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.BaseState]);
        }
    }
 public void ExecuteState()
 {
     if (StatesUtils.ValidateState(Owner, TIRED))
     {
         StatesUtils.MoveTo(Owner, Owner.CurrentSleepPlace.gameObject);
     }
     else
     {
         Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.BaseState]);
     }
 }
Ejemplo n.º 4
0
    public void ExecuteState()
    {
        if (StatesUtils.ValidateState(Owner, HORNY) && Owner.ChosenMate != null)
        {
            if (Owner.ChosenMate.GetComponent <Agent>().ActiveState == Agent.StatesEnum.MovingToMate)
            {
                StatesUtils.MoveTo(Owner, Owner.ChosenMate);
            }
            else
            {
                Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.SearchingMate]);
            }
        }

        else if (StatesUtils.ValidateState(Owner, HORNY) && Owner.ChosenMate == null)
        {
            Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.SearchingMate]);
        }

        else
        {
            Owner.StateMachineRef.ChangeState(Owner.States[Agent.StatesEnum.BaseState]);
        }
    }