示例#1
0
 public void Activate()
 {
     if (!activated)
     {
         activated = OnActivate();
         if (activated)
         {
             style.SetPowerUpSprite(null);
         }
     }
 }
示例#2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Power Up"))
        {
            if (powerUp != null)
            {
                powerUp.OnDeactivate();
            }
            powerUp = generator.GetPowerUp(gameObject);

            style.SetPowerUpSprite(powerUp.sprite);
        }
        else if (other.gameObject.GetComponent <SinglePowerUpGenerator>() != null)
        {
            SinglePowerUpGenerator gen = other.gameObject.GetComponent <SinglePowerUpGenerator>();
            if (powerUp != null)
            {
                powerUp.OnDeactivate();
            }
            powerUp = gen.GetPowerUp(gameObject);
            Destroy(other.gameObject);
        }
    }