Example #1
0
    public void AbsorbPowerUp(GameObject go)
    {
        PowerUp pu = go.GetComponent <PowerUp>();//getting the power up component

        _source.PlayOneShot(powerUpSound, 1.5f);
        pick = Random.Range(0, 3);
        switch (pick)
        {
        case 0:                         //When pickup is a multiweapon
            Bomb.CHECK = false;         //Incase last pickup was a bomb
            leftWeapon.SetActive(true); //making the other guns active
            rightWeapon.SetActive(true);
            multiActive   = true;       //Check used
            timeIncrement = 0;
            Weapon.GUN    = "Multi";
            TextManager.UpdateGun();    //update the weapon text
            _powerUpTime = Time.time;   //the current time is when the power up was absorbed
            break;

        case 1:                 //bomb power up case
            Bomb.CHECK  = true; //bomb will become active
            multiActive = false;
            break;

        case 2:         //shield power up case
            shield = 4; //setting shield back to maximum level
            _source.PlayOneShot(shieldPowerUp, 1.5f);
            TextManager.UpdateText();
            break;
        }
        pu.Absorbedby();//power up will be destroyed by this funciton
    }