Пример #1
0
 public void Update()
 {
     if (Vector3.Distance(transform.position, target) > distance)
     {
         animController.Walk(direction);
         float step = speed * Time.deltaTime;
         transform.position = Vector3.MoveTowards(transform.position, target, step);
     }
     else
     {
         animController.Attack(direction);
     }
 }
Пример #2
0
    public void AOEAttack()
    {
        if (mana - manaPerAoeAttack < 0)
        {
            return;
        }

        mana -= manaPerAoeAttack;
        if (!isAlive)
        {
            return;
        }
        AOE();

        waveAOE.Attack(Direction.Up, true);
    }
Пример #3
0
    public void Attack(Direction direction)
    {
        if (mana - manaPerAttack < 0)
        {
            return;
        }

        mana -= manaPerAttack;
        if (!isAlive)
        {
            return;
        }
        Wave(direction);
        playerAnim.Attack(direction);
        WaveAnim(direction);
    }
Пример #4
0
    private void WaveAnim(Direction direction)
    {
        switch (direction)
        {
        case Direction.Left:
            waveLeftAnim.Attack(direction, true);
            break;

        case Direction.Right:
            waveRightAnim.Attack(direction, true);
            break;

        case Direction.Up:
            waveUpAnim.Attack(direction, true);
            break;

        case Direction.Down:
            waveDownAnim.Attack(direction, true);
            break;

        default:
            throw new ArgumentOutOfRangeException(nameof(direction), direction, null);
        }
    }