コード例 #1
0
ファイル: CellSlot.cs プロジェクト: MitchKeenan0/GarlicPress
 public void OnPointerUp(PointerEventData data)
 {
     if ((movingCell != null) && (movingCell.GetCellData() != null))
     {
         movingCell.LoadCellData(movingCell.GetCellData());
         combatCell = movingCell;
         LoadCell(movingCell, movingCell.GetCellData(), false);
         combatCell.GetComponent <CombatCellMover>().SetMoving(false, this);
         combatCell.ShowCanvasGroup(true);
         combatCell.GetComponent <CombatCellMover>().FinishMoveToSlot();
         RecordMovingCell(null, null);
     }
 }
コード例 #2
0
    /// Caesium returns attacks back to the opponent
    public override bool OnAttackedAbility(CellSlot mySlot, CellSlot targetSlot)
    {
        base.OnAttackedAbility(mySlot, targetSlot);

        bool bAttackThrough = true;

        CombatantCell targetCell = targetSlot.GetComponentInChildren <CombatantCell>();

        if (targetCell != null)
        {
            int targetCellDamage = targetCell.GetDamage();

            CombatantCell myCell = mySlot.GetCell();
            if (myCell != null)
            {
                if (!battleUI)
                {
                    battleUI = FindObjectOfType <BattleUI>();
                }
                battleUI.ToastInteraction(myCell.transform.position, targetCellDamage, 2, "reflect ");
                bAttackThrough = false;
                myCell.SetDamage(targetCellDamage);
                myCell.GetComponent <CellArsenal>().StartHitAfterDelay(mySlot.transform, targetSlot.transform, myCell.GetDamage());
                myCell.SetDamage(0);
            }
        }

        return(bAttackThrough);
    }
コード例 #3
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);
            }
        }
    }
コード例 #4
0
ファイル: CellSlot.cs プロジェクト: MitchKeenan0/GarlicPress
 public void OnPointerDown(PointerEventData data)
 {
     if (boardEditor != null)
     {
         boardEditor.UpdateRemovingSlot(this);
     }
     else if ((combatCell != null) && (combatCell.GetCellData() != null))
     {
         CombatCellMover cellMover = combatCell.GetComponent <CombatCellMover>();
         if ((cellMover != null) && (cellMover.SetMoving(true, this)))
         {
             RecordMovingCell(combatCell, combatCell.GetCellData());
             combatCell.ShowCanvasGroup(true);
             ClearCell(false);
         }
     }
 }