Пример #1
0
    public void AttackOn(Vector2Int targetPosition)
    {
        if (!CanAttack)
        {
            return;
        }
        int y = targetPosition.y;
        int x = targetPosition.x;

        OnBoardDestructible attackedDestructible = Board.Destructables[y, x];

        Debug.Log("first attack");
        attackedDestructible.ReceiveDamage(Attack);
        Debug.Log("first attack");
        CanAttack = false;

        if (x == 0 || x == Board.Width - 1 || y == 0 || y == Board.Height - 1)
        {
            return;
        }

        OnBoardDragon attackedDragon = (OnBoardDragon)attackedDestructible;

        if (attackedDragon.Alive && attackedDragon.Range >= attackedDragon.DistanceTo(this) &&
            attackedDragon.CanRetaliate)
        {
            Debug.Log("second attack");
            this.ReceiveDamage(attackedDragon.Attack);
            attackedDragon.CanRetaliate = false;
        }
    }
Пример #2
0
    public override void GoPlay(Vector2Int targetPosition)
    {
        int y = targetPosition.y;
        int x = targetPosition.x;
        OnBoardDestructible attackedDestructible = Board.Destructables[y, x];

        attackedDestructible.ReceiveDamage(DamageDealt);
    }