コード例 #1
0
    /// HeavyWater 'decays' into regular Water when eliminated
    public override void OnCellDiedAbility(CombatantCell myCell)
    {
        base.OnCellDiedAbility(myCell);

        myCombatCell = myCell;
        if (myCombatCell != null)
        {
            CellSlot mySlot = myCombatCell.GetSlot();
            if (mySlot != null)
            {
                mySlot.LoadCell(myCombatCell, waterCellData, false);
            }
        }
    }
コード例 #2
0
    /// Soap has 2 60% chances to create a copy when eliminated
    public override void OnCellDiedAbility(CombatantCell myCell)
    {
        base.OnCellDiedAbility(myCell);

        if (myCell != null)
        {
            CellSlot cellSlot = myCell.GetSlot();
            if (cellSlot != null)
            {
                List <CellSlot> neighborSlots = new List <CellSlot>();
                neighborSlots       = cellSlot.GetNeighborSlots();
                numFragmentsDropped = 0;

                foreach (CellSlot cs in neighborSlots)
                {
                    float randomFragmentShot = Random.Range(0f, 1f);

                    if (((cs.GetCell() == null) || ((cs.GetCell() != null) && (cs.GetCell().GetCellData() == null))) &&
                        (randomFragmentShot <= fragmentDropRate))
                    {
                        CombatantBoard board = cs.GetBoard();
                        board.SpawnCombatCell(this, cs);
                        numFragmentsDropped++;
                    }

                    if (numFragmentsDropped >= potentialFragmentsOnCellDied)
                    {
                        break;
                    }
                }
            }

            myCell.ShowCanvasGroup(false);
            Destroy(myCell, 0.5f);
        }
    }