/** * Removes a power orb from the board * Resets its status on orbsOnBoard array * @param p The orb to remove */ public void RemoveOrb(PowerOrb p) { for (int i = 0; i < Constants.POWER_ORB_SCRIPTS.Length; i++) { if (Constants.POWER_ORB_SCRIPTS[i].ToString() == p.ToString()) { orbsOnBoard[i] = false; numOrbsLeft++; return; } } }
/** * Prepares to insert a power orb * If we have a duplicate, delete the existing power orb * else, if we have too many, delete the first effect * @param power The power orb that is attempting to be added */ private void PrepareForPowerOrb(PowerOrb power) { // Check for duplicates foreach (PowerOrb p in effects) { if (p.ToString() == power.ToString()) { RemovePower(p); return; } } // Check for overflow if (effects.Count >= MAX_EFFECTS) { RemovePower(effects[0]); } }