コード例 #1
0
        public void Tick()
        {
            switch (_state)
            {
            case State.Spawn:
                _logic.OnSpawn();
                _state = State.Turn;
                break;

            case State.Move:
                _battle.AskMoveUnitTo(this, _destX, _destY);
                _state = State.Turn;
                break;

            case State.Turn:
                if (Mana == MaxMana)
                {
                    _logic.OnAbility();
                    SubMana(MaxMana);
                    break;
                }
                _logic.OnTurn();
                break;

            case State.Die:
                _logic.OnDie();
                break;
            }
        }
コード例 #2
0
 public void OnDie()
 {
     _logic.OnDie();
     for (int i = 0; i < Buffs.Count; i++)
     {
         Buffs[i].OnDie();
     }
 }
コード例 #3
0
        public void Damage(int damage)
        {
            damage = _logic.OnDamage(damage);
            Health = Math.Max(0, Health - damage);

            if (IsStunned() && damage >= _removeStunDamage)
            {
                RemoveStun();
            }

            if (!IsAlive())
            {
                _state = State.Die;
                _logic.OnDie();
            }
        }