Ejemplo n.º 1
0
    void ResolveCellPair(CellSlot cellSlotA, CellSlot cellSlotB)
    {
        cellSlotA.HighlightForDuration(0.5f);
        cellSlotB.HighlightForDuration(0.5f);

        CellData      cellA       = null;
        CombatantCell combatCellA = null;

        if (cellSlotA.GetCell() != null)
        {
            combatCellA = cellSlotA.GetCell();
            cellA       = combatCellA.GetCellData();
        }
        CellData      cellB       = null;
        CombatantCell combatCellB = null;

        if (cellSlotB.GetCell() != null)
        {
            combatCellB = cellSlotB.GetCell();
            cellB       = combatCellB.GetCellData();
        }

        if (cellA != null)
        {
            if (cellA.bAttackAbility)
            {
                cellA.AttackAbility(cellSlotA, cellSlotB);
            }

            int cellADamage = combatCellA.GetDamage();
            if (cellADamage > 0)
            {
                combatCellA.GetComponent <CellArsenal>().StartHitAfterDelay(cellSlotA.transform, cellSlotB.transform, cellADamage);
            }
        }

        if (cellB != null)
        {
            if (cellB.bAttackAbility)
            {
                cellB.AttackAbility(cellSlotB, cellSlotA);
            }

            int cellBDamage = combatCellB.GetDamage();
            if (cellBDamage > 0)
            {
                combatCellB.GetComponent <CellArsenal>().StartHitAfterDelay(cellSlotB.transform, cellSlotA.transform, cellBDamage);
            }
        }
    }