Ejemplo n.º 1
0
    public void RemoveCell()
    {
        if (removingSlot != null)
        {
            removingSlot.ClearCell(true);
            removingSlot = null;
            hotCellData  = null;

            UpdateBoardValue();
            game.SaveGame();
            EnableRemovePanel(false);
        }
    }
Ejemplo n.º 2
0
    public void FinishMoveToSlot()
    {
        CombatantBoard myBoard = parentRectTransform.parent.GetComponentInParent <CombatantBoard>();

        if (myBoard != null)
        {
            bool      bGoodMove        = false;
            Transform closestTransform = myBoard.GetClosestSlotTo(transform.position);
            if (closestTransform != null)
            {
                CellSlot closestSlot = closestTransform.GetComponent <CellSlot>();
                if (closestSlot != cellSlot)
                {
                    transform.SetParent(closestTransform);
                    transform.localPosition = Vector3.zero;
                    transform.localScale    = Vector3.one;

                    //if ((moveOriginSlot != null) && (moveOriginSlot.GetCell() != null))
                    //{
                    //	CellData cellData = moveOriginSlot.GetCell().GetCellData();
                    //	if (cellData != null)
                    //		combatCell.LoadCellData(cellData);
                    //}

                    bGoodMove = true;
                    cellSlot  = closestSlot;
                    cellSlot.LoadCell(combatCell, movingCellData, false);
                    combatCell.SetSlot(cellSlot);

                    /// On Move Ability
                    if ((combatCell != null) && (combatCell.GetCellData() != null) &&
                        (combatCell.GetCellData().bOnMoveAbility))
                    {
                        combatCell.GetCellData().OnMoveAbility(cellSlot);
                    }
                }
                else
                {
                    /// move ended up at origin
                    transform.SetParent(cellSlot.transform);
                    transform.localPosition = Vector3.zero;
                    transform.localScale    = Vector3.one;
                }
            }

            if (bGoodMove)
            {
                if (moveCounter != null)
                {
                    moveCounter.SpendMoveToken(1);
                }

                moveOriginSlot.ClearCell(false);
            }
        }
    }
Ejemplo n.º 3
0
 public void CellDied()
 {
     if (GetCellData() != null)
     {
         if (GetCellData().bOnCellDiedAbility)
         {
             cellData.OnCellDiedAbility(this);
         }
         else
         {
             mySlot.ClearCell(true);
             ShowCanvasGroup(false);
             Destroy(gameObject, 0.5f);
         }
     }
 }