Inheritance: MonoBehaviour
Exemple #1
0
 void Awake()
 {
     ship        = GetComponentInChildren <Ship>();
     exploding   = GetComponentInChildren <Exploding>();
     engineSound = GetComponent <EngineSound>();
     hud         = GameObject.FindGameObjectWithTag(Constants.Tag_HUD);
 }
        public SoundEditor(SoundPackage package, SoundLocation type)
        {
            // Create controls and style the header
            InitializeComponent();
            headerPanel.BackColor = Color.FromArgb(51, 53, 53);

            // Set internals
            NewSound = true;
            Package  = package;
            Type     = type;

            // Create new sound
            switch (package.SoundType)
            {
            case SoundType.Engine:
                Sound = new EngineSound();
                break;

            case SoundType.Truck:
                Sound = new TruckSound();
                break;

            default:
                throw new Exception("Invalid sound type");
            }

            InitializeForm();
        }
 /// <summary>
 /// Plays an idling sound.
 /// </summary>
 public void PlayIdlingSound()
 {
     // If the current engine sound is not idling, or the engine audio is not already playing
     if (CurrentEngineSound != EngineSound.Idling ||
         !EngineAudioSource.isPlaying)
     {
         EngineAudioSource.Stop();
         EngineAudioSource.PlayOneShot(GetRandomSound(Idling));
         CurrentEngineSound = EngineSound.Idling;
     }
 }
Exemple #4
0
    // Use this for initialization
    void Start()
    {
        SoundManager    = GameObject.Find("SoundManager").GetComponent <SoundManager>();
        BackgroundMusic = GameObject.Find("BackgroundMusic").GetComponent <BackgroundMusic>();
        EngineSound     = GameObject.Find("EngineSound").GetComponent <EngineSound>();
        GooglePlay      = GameObject.FindGameObjectWithTag("GooglePlay").GetComponent <GooglePlay>();

        if (SoundManager.IsOff())
        {
            volume.GetComponent <Image>().sprite = soundOff;
            SoundsEnabled = false;
        }
    }
    public void PlayFlightAudio(VesselType type)
    {
        //Set engine sound
        EngineSound engineSound = audioSettings.engineSounds.Where(x => x.type == type).First();

        flightAudioSource.clip   = engineSound.clip;
        flightAudioSource.volume = engineSound.defaultVolume;
        flightAudioSource.loop   = true;
        flightAudioSource.Play();

        defaultFlightPitch = engineSound.defaultPitch;

        //Set thrust sound
        Sound thrustSound = audioSettings.soundEffects.Where(x => x.type == SoundType.EngineThrust).First();

        thrustAudioSource.clip   = thrustSound.clip;
        thrustAudioSource.volume = 0;
        thrustAudioSource.loop   = true;
    }
Exemple #6
0
 public void EmitSound2(Edict entity, SoundChannel channel, string sample, float volume, float attenuation, SoundFlags flags, int pitch)
 {
     EngineSound.EmitSound(entity, channel, sample, volume, attenuation, flags, pitch);
 }
Exemple #7
0
 private void Start()
 {
     engineSound = GetComponent <EngineSound>();
 }
Exemple #8
0
    public VehicleModel()
    {
        VehicleOverview = new VehicleOverview();
        engine          = new Engine();
        starter         = new Starter();
        gearBox         = new GearBox();
        vehGearNum      = 0;
        for (int i = 0; i < subGears.Length; i++)
        {
            subGears[i] = new SubGear();
        }
        windForce      = new WindForce();
        steeringFactor = new SteeringFactor();
        steering       = new Steering();
        fuelTank       = new FuelTank();

        for (int i = 0; i < otherSteerings.Length; i++)
        {
            otherSteerings[i] = new OtherSteering();
        }
        carVibration        = new CarVibration();
        brakesCommon        = new Brakes();
        physicsCrashSetting = new PhysicsCrashSetting();
        ignoreHeadCollision = false;
        exhaust             = new Exhaust();
        roughness           = new Roughness();
        engineHealth        = new EngineHealth();
        fuelTankOnCrash     = 0;
        engineParticles     = new EngineParticles();
        gearboxSettings     = new GearboxSettings();
        wheels                       = new Wheel();
        body                         = new Body();
        bumper                       = new Bumper();
        windowGlass                  = new WindowGlass();
        light                        = new Light();
        licencePlate                 = new LicencePlate();
        mirror                       = new Mirror();
        wing                         = new Wing();
        door                         = new Door();
        roof                         = new Roof();
        unknown                      = new Unknown();
        engineSoundSet               = new EngineSoundSet();
        engineSound1                 = new EngineSound();
        engineSound2                 = new EngineSound();
        engineSound3                 = new EngineSound();
        engineSound4                 = new EngineSound4();
        insideSoundSet               = new InsideSoundSet();
        carSmallHitType              = new CarSmallHitType();
        carShortCrashTypeB1          = new CarShortCrashType();
        carShortCrashWithGlassTypeC1 = new CarShortCrashType();
        unknownSound1                = "";
        unknownSound2                = "";
        engineStartSound             = new EngineStartSound();
        engineSoundDriving           = new EngineSoundDriving();
        for (int i = 0; i < engineSoundOnGears.Length; i++)
        {
            engineSoundOnGears[i] = new EngineSoundOnGear();
        }
        engineSoundIdle             = new EngineSoundIdle();
        wheelSoundWhilePunctured    = new WheelSoundWhilePunctured();
        carSmallHitType1            = new CarSmallHitType();
        carLongCrashType1           = new CarLongCrashType();
        carShortCrashWithGlassType1 = new CarShortCrashType();
        doorOpenCloseSound          = new DoorOpenCloseSound();
        insideSoundSet               = new InsideSoundSet();
        carSmallHitType              = new CarSmallHitType();
        carLongCrashType2            = new CarLongCrashType();
        carShortCrashTypeB1          = new CarShortCrashType();
        carShortCrashWithGlassTypeC1 = new CarShortCrashType();
        unknownSound1               = "";
        unknownSound2               = "";
        carShortCrashTypeB2         = new CarShortCrashType();
        carShortCrashWithGlassType1 = new CarShortCrashType();
        doorOpenCloseSound          = new DoorOpenCloseSound();
    }
Exemple #9
0
 private void Awake()
 {
     engineSound      = GetComponent <EngineSound>();
     currentNodeIndex = 0;
     nodeCount        = 0;
 }