Example #1
0
    public void Ignition()
    {
        if (!GameControlScript.ShipRunning && !startupSoundPlayed && GameControlScript.IgnitionLeverValue == 1)
        {
            MasterAudio.PlaySound3DFollowTransformAndForget("WarmupSequence", this.gameObject.transform);
            MasterAudio.PlaySound3DFollowTransformAndForget("EngineLoop", this.gameObject.transform);

            startupSoundPlayed  = true;
            shutdownSoundPlayed = false;
            GameControlScript.ActivateShip();
            CollidersWhenShutdown.SetActive(false);
            CollidersWhenRunning.SetActive(true);
        }


        else if (GameControlScript.ShipRunning && !shutdownSoundPlayed && GameControlScript.IgnitionLeverValue == 0)
        {
            MasterAudio.PlaySound3DFollowTransformAndForget("Shutdown", this.gameObject.transform);
            MasterAudio.StopSoundGroupOfTransform(this.gameObject.transform, "EngineLoop");
            shutdownSoundPlayed = true;
            startupSoundPlayed  = false;
            GameControlScript.DeactivateShip();
            CollidersWhenShutdown.SetActive(true);
            CollidersWhenRunning.SetActive(false);
        }
    }