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); } }
public void AOEAttack() { if (mana - manaPerAoeAttack < 0) { return; } mana -= manaPerAoeAttack; if (!isAlive) { return; } AOE(); waveAOE.Attack(Direction.Up, true); }
public void Attack(Direction direction) { if (mana - manaPerAttack < 0) { return; } mana -= manaPerAttack; if (!isAlive) { return; } Wave(direction); playerAnim.Attack(direction); WaveAnim(direction); }
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); } }