Exemple #1
0
    public void AddPowerup(string powerup)
    {
        List <SimpleChip> chips = new List <SimpleChip>(FindObjectsOfType <SimpleChip>());

        if (chips.Count == 0)
        {
            return;
        }
        SimpleChip chip = chips.Where(x => x != null && !x.chip.busy).ToList().GetRandom();
        Slot       slot = chip.chip.slot;

        if (slot)
        {
            AddPowerup(slot.coord, powerup);
        }
    }
Exemple #2
0
    public void AddPowerup(Powerup p)
    {
        SimpleChip[] chips = GameObject.FindObjectsOfType <SimpleChip>();
        if (chips.Length == 0)
        {
            return;
        }
        SimpleChip chip = null;

        while (chip == null || chip.matching)
        {
            chip = chips[Random.Range(0, chips.Length - 1)];
        }
        SlotForChip slot = chip.chip.parentSlot;

        AddPowerup(slot.slot.x, slot.slot.y, p);
    }