Esempio n. 1
0
    private void Attack()
    {
        lastAttack = Time.time + player.character.CharacterStats.AttackSpeed;

        switch (player.direction)
        {
        case Player.Direction.Right:
            target = nodeManager.AttackNode(player.GetColumn() + 1, player.GetRow());
            break;

        case Player.Direction.Left:
            target = nodeManager.AttackNode(player.GetColumn() - 1, player.GetRow());
            break;

        case Player.Direction.Up:
            target = nodeManager.AttackNode(player.GetColumn(), player.GetRow() + 1);
            break;

        case Player.Direction.Down:
            target = nodeManager.AttackNode(player.GetColumn(), player.GetRow() - 1);
            break;
        }
        if (target is IDamageable)
        {
            IDamageable t = (IDamageable)target;
            t.TakeDamage(player.character);
        }
    }