예제 #1
0
        public void Update()
        {
            if ((_autoActionBlocking) || (_movementBlockDuration > 0.0f))
            {
                _motionEngine.StopMoving();
            }
            else if (_isMoving)
            {
                Vector2 vectorToTarget = _movementTarget - _transform.position;

                if (vectorToTarget.magnitude > Movement_Target_Stopping_Distance)
                {
                    _motionEngine.MoveTowardsPosition(_movementTarget);
                    _displayController.IsMoving = true;
                    _displayController.SetFacing(_movementTarget);
                }
                else
                {
                    EndFieldMovement();
                    _statusEventDispatcher.FireStatusEvent(StatusMessage.CompletedFieldMovement);
                }
            }

            _movementBlockDuration = Mathf.Max(_movementBlockDuration - Time.deltaTime, 0.0f);
        }
예제 #2
0
 private void StartAutoActionSequence()
 {
     _actionInProgress     = true;
     _actionEffectHasFired = false;
     _statusEventDispatcher.FireStatusEvent(StatusMessage.StartedAutoAction);
     _displayController.TriggerAutoAction();
 }
예제 #3
0
 private void Update()
 {
     _autoActionController.Update();
     if (!_autoActionController.HasTarget)
     {
         _statusEventDispatcher.FireStatusEvent(StatusMessage.NpcActionTargetRequested);
     }
 }
예제 #4
0
 private void HandleSelfSelection()
 {
     if (CharacterUtilities.CharacterTargetsAllies(_currentActiveCharacter))
     {
         Debug.Log(_currentActiveCharacter.name + ": targets FRIENDLIES - setting target to " + Transform.name);
         _statusEventDispatcher.FireStatusEvent(_currentActiveCharacter, StatusMessage.AlliedActionTargetSelected);
         _statusEventDispatcher.FireStatusEvent(_currentActiveCharacter, StatusMessage.CharacterDeactivated);
     }
     else
     {
         Debug.Log(Transform.name + " was set to active");
         _currentActiveCharacter = Transform;
         _statusEventDispatcher.FireStatusEvent(StatusMessage.CharacterActivated);
     }
 }
예제 #5
0
 private void HandleHealthLoss(float delta)
 {
     _currentHealth = Mathf.Max(0.0f, _currentHealth - delta);
     UpdateHealthBar();
     if (_currentHealth <= 0.0f)
     {
         _displayController.TriggerDeathAnimation();
         _statusEventDispatcher.FireStatusEvent(StatusMessage.CharacterDead);
     }
     else if (!_actionInProgress)
     {
         _displayController.TriggerHurtAnimation();
     }
 }
 public void HandleClickedOn()
 {
     _statusEventDispatcher.FireStatusEvent(StatusMessage.CharacterSelected);
 }