示例#1
0
        public void Start()
        {
            soundsBase  = CarVFXSettings.Instance;
            audioSource = GetComponent <AudioSource>();
            CarControlBase carControl = GetComponent <CarControlBase>();

            carControl.OnCarBoost  += PlayCarBoostSound;
            carControl.OnCarRotate += PlayCarRotateSound;
            carControl.OnCarRun    += PlayCarRunSound;
            GetComponent <CarBase>().OnCarCrashed += PlayCarCrashSound;
            GetComponent <CarBase>().OnBoxCrashed += PlayBoxCrashedSound;
        }
        private void Start()
        {
            settings = CarVFXSettings.Instance;

            carAnimator         = GetComponentInChildren <Animator>(true);
            carAnimator.enabled = false;

            BoosterParticles.Stop();

            var controller = GetComponent <CarControlBase>();

            controller.OnCarBoostEnd         += BoosterParticles.Stop;
            controller.OnCarBoostBegin       += BoosterParticles.Play;
            controller.OnCarBoostDash        += BoosterBlastParticles.Play;
            controller.OnCarRotate           += RotateCar;
            controller.OnCarRun              += Torque;
            GetComponent <CarBase>().OnDeath += x => CarDeath();
        }