Beispiel #1
0
    // Add a power up to the player. The durations are directly placed here.
    public void PickPowerUp(PowerUp.PowerUpTypes type)
    {
        powerUpsPicked[(int)type] = true;
        switch (type)
        {
        case PowerUp.PowerUpTypes.REGENERATION:
            powerUpsTime[(int)type] = Time.time + 20.0f;
            break;

        case PowerUp.PowerUpTypes.TURBO:
            motor.SetSpeedPowerUp(true);
            powerUpsTime[(int)type] = Time.time + 40.0f;
            break;

        case PowerUp.PowerUpTypes.MEGAPROTECTION:
            shield = maxShield;
            OnShieldChanged();
            powerUpsTime[(int)type] = Time.time + 10.0f;
            break;

        case PowerUp.PowerUpTypes.VAMPIBOT:
            powerUpsTime[(int)type] = Time.time + 30.0f;
            break;

        case PowerUp.PowerUpTypes.QUICKFIRE:
            powerUpsTime[(int)type] = Time.time + 25.0f;
            break;
        }
        OnPowerUpChanged(type, true);   // Delegate. Implemented by Game.cs
    }
Beispiel #2
0
        public virtual bool ActivatePowerUp(PowerUp.PowerUpTypes PowerUpType)
        {
            int ActiveTime = 600;

            switch (PowerUpType)
            {
            case PowerUp.PowerUpTypes.VehiculeRegen:
                ActivePowerUpEnergieTime = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.Shield:
                return(true);

            case PowerUp.PowerUpTypes.VehiculeRepair:
                return(true);

            case PowerUp.PowerUpTypes.VehiculeSpeed:
                ActivePowerUpSpeedTime = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.Power1:
                ArrayWeaponPrimary[0].ActivePowerUpDamage = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.Power2:
                ArrayWeaponPrimary[1].ActivePowerUpDamage = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.Power3:
                ArrayWeaponPrimary[2].ActivePowerUpDamage = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.RateOfFire1:
                ArrayWeaponPrimary[0].ActivePowerUpRateOfFire = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.RateOfFire2:
                ArrayWeaponPrimary[1].ActivePowerUpRateOfFire = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.RateOfFire3:
                ArrayWeaponPrimary[2].ActivePowerUpRateOfFire = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.Speed1:
                ArrayWeaponPrimary[0].ActivePowerUpSpeed = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.Speed2:
                ArrayWeaponPrimary[1].ActivePowerUpSpeed = ActiveTime;
                return(true);

            case PowerUp.PowerUpTypes.Speed3:
                ArrayWeaponPrimary[2].ActivePowerUpSpeed = ActiveTime;
                return(true);
            }
            return(false);
        }
Beispiel #3
0
 // Shows/hides a power up icon.
 public void SetPowerUpIconActive(PowerUp.PowerUpTypes type, bool isActive)
 {
     powerUpImages[(int)type].gameObject.SetActive(isActive);
 }
Beispiel #4
0
 // Updates the HUD's power ups icons.
 private void UpdatePowerUpIcons(PowerUp.PowerUpTypes type, bool isActive)
 {
     hud.SetPowerUpIconActive(type, isActive);
 }