예제 #1
0
 private void OnPauseStatusChanged(PauseStatusChangedMessage inMessage)
 {
     if (inMessage.NewPauseStatus == EPauseStatus.Paused)
     {
         _actionStateMachine.RequestActionState(EActionStateMachineTrack.UI, EActionStateId.OpenMenuUI, new ActionStateInfo(gameObject));
     }
     else
     {
         _actionStateMachine.RequestActionState(EActionStateMachineTrack.UI, EActionStateId.Null, new ActionStateInfo(gameObject));
     }
 }
예제 #2
0
        private void InitialiseAI()
        {
            if (_healthInterface != null)
            {
                _healthInterface.ReplenishHealth();
            }

            if (_actionStateMachine != null)
            {
                _actionStateMachine.RequestActionState(EActionStateMachineTrack.Locomotion, EActionStateId.Null, new ActionStateInfo(gameObject));
            }
        }
예제 #3
0
        private void OnHealthSet(int newHealth, GameObject healthAdjuster = null)
        {
            if (CanAdjustHealth())
            {
                var healthChange = newHealth - _currentHealth;
                _currentHealth = newHealth;
                _currentHealth = Mathf.Clamp(_currentHealth, 0, GetMaxHealth());

                UnityMessageEventFunctions.InvokeMessageEventWithDispatcher(gameObject, new HealthChangedMessage(healthChange, _currentHealth, healthAdjuster));

                if (_currentHealth <= 0)
                {
                    _stateMachine.RequestActionState(EActionStateMachineTrack.Locomotion, EActionStateId.Dead, new ActionStateInfo(gameObject));
                }
            }
        }