Пример #1
0
 /**
  * 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;
         }
     }
 }
Пример #2
0
    /**
     * Removes a power orb from the player's effects
     * @param p The power orb to remove
     */
    public void RemovePower(PowerOrb p)
    {
        // Get rid of power orb
        p.EndOrb();
        effects.Remove(p);
        Destroy(p.gameObject);
        UpdateEffectsUI();

        angle = trueLastAngle;                                  // Reset angle
        ApplyEffects();                                         // Apply any remaining effects
        playerPointer.rotation = Quaternion.Euler(0, 0, angle); // Then set the player's pointer
    }
Пример #3
0
    /**
     * Adds a power orb to the player's effects
     * @param orb The power orb to add
     */
    public void AddPower(GameObject orb)
    {
        PowerOrb p = orb.GetComponent <PowerOrb>();

        PrepareForPowerOrb(p);

        // Add the power orb
        p.SetPlayer(this);
        effects.Insert(0, p);
        orb.transform.parent      = transform;
        orb.transform.localScale *= 2;
        UpdateEffectsUI();
    }
Пример #4
0
 /**
  * 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]);
     }
 }