コード例 #1
0
 private void HurtUpdate()
 {
     _hurtTimer -= Time.deltaTime;
     if (_hurtTimer <= 0f) {
         _currentMessage = null;
     }
 }
コード例 #2
0
    private bool CheckState()
    {
        bool stateChanged = false;
        if (_currentMessage == null && _messages.Count > 0) {
            State oldState = _state;
            _currentMessage = _messages.Dequeue();
            _state = State.Idle;

            if (_currentMessage.Source == _combatant) {
                MoveAction.Message move = _currentMessage as MoveAction.Message;
                DamageMessage damage = _currentMessage as DamageMessage;
                if (move != null) {
                    OnMove(move);
                } else if (damage != null) {
                    OnDamage(damage);
                }
            }

            stateChanged = oldState != _state;
        }

        return stateChanged;
    }
コード例 #3
0
 private void MoveUpdate()
 {
     transform.position = Vector3.MoveTowards(transform.position, _moveEnd, 8f * Time.deltaTime);
     if (transform.position == _moveEnd) {
         _currentMessage = null;
     }
 }
コード例 #4
0
 public void OnMessage(MessageArgs message)
 {
     if (message.Source == _combatant || message.Target == _combatant) {
         _messages.Enqueue(message);
     }
 }
コード例 #5
0
 public void HandleMessage(object sender, MessageArgs message)
 {
     _messages.Enqueue(message);
 }