Esempio n. 1
0
        public void Update()
        {
            Volume       = KnobState / 10f;
            inputDelay  -= Time.deltaTime;
            volumeDelay -= Time.deltaTime;

            if (Raycast.GetHit(knobCollider))
            {
                guiUse.Value         = true;
                guiInteraction.Value = interaction;

                if (KnobState < 10f && Input.GetAxis(mouseWheel) < 0f && inputDelay <= 0f)
                {
                    KnobState++;
                    knob.localEulerAngles = new Vector3(0f, -30 * KnobState, 0f);
                    MasterAudio.PlaySound3DAndForget("CarFoley", transform, variationName: "cd_button");
                    inputDelay  = 0.1f;
                    volumeDelay = 0.2f;
                }
                else if (KnobState > 0f && Input.GetAxis(mouseWheel) > 0f && inputDelay <= 0f)
                {
                    KnobState--;
                    knob.localEulerAngles = new Vector3(0f, -30 * KnobState, 0f);
                    inputDelay            = 0.1f;
                    volumeDelay           = 0.2f;
                }
            }
        }
Esempio n. 2
0
        void Buttons()
        {
            inputDelay -= Time.deltaTime;
            //RadioCDSwitch
            if (Raycast.GetHit(RadioCDSwitch))
            {
                guiUse.Value         = true;
                guiInteraction.Value = InteractionRadioCD;

                if (Input.GetMouseButtonDown(0) && inputDelay <= 0f)
                {
                    if (RADIOCD)
                    {
                        RADIOCD      = false;
                        displaydelay = 0.95f;
                    }
                    else
                    {
                        RADIOCD        = true;
                        ChangedChannel = true;
                    }

                    MasterAudio.PlaySound3DAndForget("CarFoley", transform, variationName: "cd_button");
                    inputDelay = 0.02f;
                }
            }
            //TrackChannelSwitch
            if (Raycast.GetHit(TrackChannelSwitch))
            {
                guiUse.Value = true;

                if (RADIOCD)
                {
                    guiInteraction.Value = InteractionTrackChannel1;

                    if (Input.GetMouseButtonDown(0) && inputDelay <= 0f)
                    {
                        if (Channel)
                        {
                            Channel        = false;
                            ChangedChannel = true;
                        }
                        else
                        {
                            Channel        = true;
                            ChangedChannel = true;
                        }

                        MasterAudio.PlaySound3DAndForget("CarFoley", transform, variationName: "cd_button");
                        inputDelay = 0.02f;
                    }
                }
                else if (!RADIOCD && CD)
                {
                    guiInteraction.Value = InteractionTrackChannel2;

                    if (Input.GetMouseButtonDown(0) && inputDelay <= 0f)
                    {
                        if (PlayingTrack == clips.Length)
                        {
                            PlayingTrack = 0;
                        }
                        else
                        {
                            PlayingTrack++;
                        }
                        cdAudio.clip = clips[PlayingTrack];
                        cdAudio.Play();

                        MasterAudio.PlaySound3DAndForget("CarFoley", transform, variationName: "cd_button");
                        inputDelay = 0.02f;
                    }
                    else if (Input.GetMouseButtonDown(1) && inputDelay <= 0f)
                    {
                        if (cdAudio.time >= 5f)
                        {
                            cdAudio.Play();
                        }
                        else
                        {
                            if (PlayingTrack == 0)
                            {
                                PlayingTrack = clips.Length - 1;
                            }
                            else
                            {
                                PlayingTrack--;
                            }
                            cdAudio.clip = clips[PlayingTrack];
                            cdAudio.Play();
                        }

                        MasterAudio.PlaySound3DAndForget("CarFoley", transform, variationName: "cd_button");
                        inputDelay = 0.02f;
                    }
                }
            }
            //Eject
            if (Raycast.GetHit(Eject))
            {
                if (CD)
                {
                    guiUse.Value         = true;
                    guiInteraction.Value = InteractionEject;

                    if (Input.GetMouseButtonDown(0) && inputDelay <= 0f)
                    {
                        StartCoroutine(SledOut());

                        MasterAudio.PlaySound3DAndForget("CarFoley", transform, variationName: "cd_button");
                        inputDelay = 0.02f;
                    }
                }
            }
        }