예제 #1
0
    void PlaySound(char Letter)
    {
        Letter = char.ToLower(Letter);

        for (int i = 0; i < Alphabet.Length; i++)
        {
            if (Letter == Alphabet[i])
            {
                CurrentSource.Sound = CurrentVoice.Letters[i];
                CurrentSource.SetPitch(CurrentVoice.Pitch);
                CurrentSource.Play();
            }
        }
    }
예제 #2
0
    void WheelSkidSound()
    {
        float newVolume = 0;
        float newPitch  = 0;

        if (sidewaysSlip > 0.3f)
        {
            newVolume += sidewaysSlip;
            newPitch  += sidewaysSlip;
        }
        if (forwardSlip > 0.4f)
        {
            newVolume += forwardSlip;
            newPitch  += forwardSlip;
        }

        audioController.SetVolume(newVolume / 2);
        audioController.SetPitch(newPitch / 2);
    }
예제 #3
0
    void Update()
    {
        RefreshLoopingAudioLevels();

        float SpeedAlpha = r.velocity.magnitude / VehicleMaxSpeed;

        if (SpeedAlpha > 1f)
        {
            SpeedAlpha = 1f;
        }

        ASC_Engine.SetPitch(Mathf.Lerp(PitchLow, PitchHigh, SpeedAlpha));
        ASC_Engine.SetVolume(1f);

        ASC_Road.SetVolume(Mathf.Lerp(0f, 0.25f, SpeedAlpha));

        ASC_Wind.SetPitch(SpeedAlpha);
        ASC_Wind.SetVolume(SpeedAlpha);
    }
예제 #4
0
    void Update()
    {
        RefreshLoopingAudioLevels();

        if (!M.Paused)
        {
            if (!Frozen)
            {
                CameraControls();
                if (!M.C.Active)
                {
                    ZoomControls();

                    if (!RadioSwapping && CurrentStation != 0)
                    {
                        if (Input.mouseScrollDelta.y > 0f)
                        {
                            ChangeStation(true);
                        }

                        if (Input.mouseScrollDelta.y < 0f)
                        {
                            ChangeStation(false);
                        }
                    }
                }
            }

            if (Input.GetKeyDown("q") && !M.C.Active)
            {
                ASC_Misc.Sound = BrightsSound;
                ASC_Misc.SetVolume(1f);
                ASC_Misc.Play();
                Brights = !Brights;
            }

            if (Brights)
            {
                Headlight.intensity = BrightLight;
                Headlight.range     = BrightRange;
                BrightEffect();
            }
            else
            {
                Headlight.intensity = LowLight;
                Headlight.range     = LowRange;
            }

            float   ShakeAmount = Offroading ? 0.025f * (r.velocity.magnitude / MaxSpeed) : 0.005f * (r.velocity.magnitude / MaxSpeed);
            Vector3 ShakeVec    = new Vector3(Random.Range(-ShakeAmount, ShakeAmount), Random.Range(-ShakeAmount, ShakeAmount), Random.Range(-ShakeAmount, ShakeAmount));
            ToPitch.transform.localPosition = ShakeVec;

            SpeedDial.Value = r.velocity.magnitude;

            float SpeedAlpha = r.velocity.magnitude / MaxSpeed;
            if (SpeedAlpha > 1f)
            {
                SpeedAlpha = 1f;
            }

            ASC_Road.SetVolume(Offroading ? Mathf.Lerp(0f, 1f, SpeedAlpha) : Mathf.Lerp(0f, 0.25f, SpeedAlpha));
            ASC_OffRoad.SetVolume(Offroading ? Mathf.Lerp(0f, 1f, SpeedAlpha) : Mathf.Lerp(0f, 0.5f, SpeedAlpha));

            //ASC_Engine.SetVolume(Mathf.Lerp(0.5f, 1f, SpeedAlpha));
            ASC_Engine.SetPitch(Mathf.Lerp(PitchLow, PitchHigh, SpeedAlpha));

            SpeedAlpha -= 0.4f;
            if (SpeedAlpha < 0f)
            {
                SpeedAlpha = 0f;
            }
            ASC_Wind.SetPitch(SpeedAlpha);


            if (!ASC_Radio.AS.isPlaying && CurrentStation != 0 && !RadioSwapping)
            {
                PlaySong();
            }


            SkidSounds();
        }
    }
예제 #5
0
    IEnumerator RandomCalls()
    {
        while (true)
        {
            yield return(new WaitForSeconds(Random.Range(PhoneCallRandomness.x, PhoneCallRandomness.y)));

            int     RandomCaller = Random.Range(0, SpamCallers.Count);
            TextBox TB           = null;
            while (!TB)
            {
                yield return(new WaitForSeconds(0.5f));

                TB = GameObject.FindWithTag("TextBox").GetComponent <TextBox>();
            }

            if (!GetComponent <DashObject>().PickedUp&& !GetComponent <DashObject>().Locked&& !InCall && !TB.isActive)
            {
                if (GameObject.FindWithTag("Manager").GetComponent <Manager>().TimeIndex != 0 && GameObject.FindWithTag("Manager").GetComponent <Manager>().TimeIndex < 600)
                {
                    ASC.Sound = PhoneCallSound;
                    ASC.SetVolume(1f);
                    ASC.AS.loop = true;
                    ASC.Play();

                    PhoneNumber      = "";
                    PhoneScreen.text = "Incoming : " + SpamCallers[RandomCaller].CallerID;
                    DashObject DO = GetComponent <DashObject>();

                    int  Frames   = 0;
                    bool Answered = false;
                    while (Frames < (7 * 60))
                    {
                        yield return(null);

                        Frames++;

                        if (DO.PickedUp)
                        {
                            Answered = true;
                            Frames   = 1000;
                        }
                    }

                    if (Answered)
                    {
                        PhoneScreen.text = SpamCallers[RandomCaller].CallerID;
                        InCall           = true;

                        ASC.AS.loop = false;
                        ASC.Stop();


                        TB.CurrentVoice  = SpamCallers[RandomCaller].CallerVoice;
                        TB.CurrentSource = ASC;
                        ASC.SetVolume(1f);

                        int Index = 0;

                        bool HungUp = false;

                        while (Index < SpamCallers[RandomCaller].Lines.Count && HungUp == false)
                        {
                            TB.DisplayText(SpamCallers[RandomCaller].Lines[Index]);

                            while (TB.isPrinting && HungUp == false)
                            {
                                yield return(null);

                                if (!DO.PickedUp)
                                {
                                    HungUp = true;
                                }
                            }

                            /*
                             * Frames = 0;
                             * while(!HungUp && Frames < 30)
                             * {
                             *  yield return null;
                             *  Frames++;
                             *  if(!DO.PickedUp)
                             *  {
                             *      HungUp = true;
                             *  }
                             * }*/

                            Index++;
                        }

                        TB.Toggle();
                        ASC.SetPitch(1f);

                        if (!HungUp)
                        {
                            GetComponent <DashObject>().RemoveFromHands();
                        }

                        Clear();
                        InCall = false;
                    }

                    ASC.AS.loop = false;
                    ASC.Stop();

                    PhoneScreen.text = "";
                }
            }
        }
    }