示例#1
0
    void Update()
    {
        CurrentAnimState.Update();

        _footStepTimer  += Time.deltaTime;
        _footStepTimeout = 0.1f;


        if (MyStatus.Health > 0)
        {
            UpdateLookDirection();

            UpdateDestBodyAngle();

            MyStatus.UpdateBodyStatusEveryone();
            if (MyStatus.Health <= 0)
            {
                MyStatus.Health = 0;
                OnDeath(Vector3.zero);
            }

            MyAI.AlwaysPerFrameUpdate();
        }

        bool isAlert = IsAlert();

        if (isAlert)
        {
            if (MyAnimator.GetInteger("AlertLevel") <= 1)
            {
                MyAnimator.SetInteger("AlertLevel", 2);
                //Debug.LogError("setting alert level to TWO");
            }
        }
        else
        {
            if (MyAnimator.GetInteger("AlertLevel") > 1)
            {
                MyAnimator.SetInteger("AlertLevel", 1);
                //Debug.LogError("setting alert level to ONE");
            }
        }

        if (ActionState == HumanActionStates.Twitch)
        {
            if (_twitchTimer > 0)
            {
                _twitchTimer -= Time.deltaTime;
            }
            else
            {
                _twitchTimer = 0;
                OnInjuryRecover();
            }
        }

        GoapAction action = MyAI.GetCurrentAction();

        if (action != null)
        {
            CurrentAction = action.Name;
        }
        else
        {
            CurrentAction = "NONE";
        }

        UpdateFading();
    }