예제 #1
0
    // Update is called once per frame
    void Update()
    {
        Debug.Log(audioSource.isPlaying);

        switch (singleton.state)
        {
        case TardisState.Shutdown:
            if (lastState != singleton.state)
            {
                audioSource.clip = starting;
                audioSource.Play();
            }
            break;

        case TardisState.TakeOff_1:
            if (lastState != singleton.state)
            {
                audioSource.clip = takeOff;
                audioSource.Play();
            }
            break;

        default:
            if (!audioSource.isPlaying)
            {
                audioSource.clip = humming;
                audioSource.Play();

                lastState = singleton.state;
            }
            break;
        }

        lastState = singleton.state;
    }
예제 #2
0
 private TardisSingleton()
 {
     state = TardisState.Shutdown;
 }
예제 #3
0
 // Start is called before the first frame update
 void Start()
 {
     audioSource = gameObject.AddComponent <AudioSource>();
     singleton   = TardisSingleton.GetInstance();
     lastState   = TardisState.Flying; //Tout sauf Shutdown
 }