示例#1
0
    public void PowerUp(int powerId)
    {
        if (Ship != null)
        {
            switch (powerId)
            {
            case 1:
                Nukes++;
                break;

            case 2:
                bulletDamageMult += 0.1f;
                Shot Dmg = Ship.GetComponentInChildren <Shot>();
                if (Dmg != null)
                {
                    Dmg.damageMultiplier = bulletDamageMult;
                }
                break;

            case 3:
                bulletSpeedMult += 0.01f;
                Shot Spd = Ship.GetComponentInChildren <Shot>();
                if (Spd != null)
                {
                    Spd.speedMultiplier = bulletDamageMult;
                }
                break;

            case 4:
                bulletFirerateMult += 0.1f;
                Shot Frt = Ship.GetComponentInChildren <Shot>();
                if (Frt != null)
                {
                    Frt.fireMultiplier = bulletFirerateMult;
                }
                break;

            case 5:
                HpControl lifes = Ship.GetComponentInChildren <HpControl>();
                if (lifes != null)
                {
                    lifes.extraLife();
                }
                break;

            case 6:
                HpControl baseHealth = Base.GetComponent <HpControl>();
                if (baseHealth != null)
                {
                    baseHealth.GainHealth(30);
                }
                break;

            case 7:
                HpControl shpHealth = Ship.GetComponentInChildren <HpControl>();
                if (shpHealth != null)
                {
                    shpHealth.GainHealth(30);
                }
                break;

            case 8:
                Shot Sprd = Ship.GetComponentInChildren <Shot>();
                if (Sprd != null)
                {
                    Sprd.SpreadLevelUp();
                }
                break;

            case 9:
                BulletCollection bullLvl = Ship.GetComponentInChildren <BulletCollection>();
                bullLvl.LevelUp();
                break;

            default:
                break;
            }
        }
    }