private void HurtUpdate() { _hurtTimer -= Time.deltaTime; if (_hurtTimer <= 0f) { _currentMessage = null; } }
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; }
private void MoveUpdate() { transform.position = Vector3.MoveTowards(transform.position, _moveEnd, 8f * Time.deltaTime); if (transform.position == _moveEnd) { _currentMessage = null; } }
public void OnMessage(MessageArgs message) { if (message.Source == _combatant || message.Target == _combatant) { _messages.Enqueue(message); } }
public void HandleMessage(object sender, MessageArgs message) { _messages.Enqueue(message); }