Example #1
0
    void Update()
    {
        #region StateConditions


        //first attempt to eat



        if (_timeScript.currentTime > 2200 || _timeScript.currentTime > 000 && _timeScript.currentTime < 500)
        {
            currentState = farmerStates.Sleeping;
        }

        if (_timeScript.currentTime > 501 && _timeScript.currentTime < 1900)
        {
            currentState = farmerStates.Farming;
        }

        if (_timeScript.currentTime > 1901 && _timeScript.currentTime < 2159)
        {
            if (hunger >= 50 && foodNum > 0)
            {
                currentState = farmerStates.Eating;
            }
            else if (hunger > 50 && foodNum <= 0)
            {
                currentState = farmerStates.BuyingFood;
            }
        }



        print("CS = " + currentState);



        #endregion

        #region State Actions
        if (currentState == farmerStates.Traversing)
        {
            _arrivalScript.ArrivalBehaviour(transform.position, currentTarget);
        }

        if (currentState == farmerStates.Eating)
        {
        }


        if (currentState == farmerStates.Farming)
        {
            tiredness    += 0.025f;
            currentTarget = waypoints[fields].transform.position;
            _arrivalScript.ArrivalBehaviour(transform.position, currentTarget);
        }

        if (currentState == farmerStates.BuyingFood)
        {
        }



        if (currentState == farmerStates.Sleeping)
        {
            isSleeping    = true;
            currentTarget = waypoints[bed].transform.position;
            _arrivalScript.ArrivalBehaviour(transform.position, currentTarget);
            tiredness = _basicFunctions.Sleep(tiredness, sleepStat);
            if (tiredness == 0)
            {
                isSleeping   = false;
                currentState = farmerStates.Farming;
            }
        }

        #endregion
    }
Example #2
0
 void Update()
 {
     _arrivalScript.ArrivalBehaviour(transform.position, currentTarget);
 }