/// <summary> /// Method that is comprised of the acceleration methods /// </summary> private void Movement() { float input = PlayerInputs.GetAxisRaw("Button0"); if (input > 0.01f && _lastInput <= 0.01f) { _onMovementStart?.Invoke(); if (input > 0.01f && !MatchManager.Started) { NoiseManager.PlaySound(this.gameObject, "car_accelerate3", true, false, true); } } if (input > 0.1f && _carEffects.MoveParticles.isStopped && IsGrounded) { _carEffects.MoveParticles.Play(); if (MatchManager.Started) { NoiseManager.PlaySound(this.gameObject, "car_motor1", true, true); } } if (input < 0.1f && !_carEffects.MoveParticles.isStopped) { _carEffects.MoveParticles.Stop(); NoiseManager.StopSound(this.gameObject); } if (!IsGrounded && !_carEffects.MoveParticles.isStopped) { print("Stop particles"); _carEffects.MoveParticles.Stop(); NoiseManager.StopSound(this.gameObject); } if (!MatchManager.Started) { return; } if (IsGrounded) { VroomVroom(); Skrrrrt(); _lastInput = input; } else { _moveVector = transform.forward * _velocity; _moveVector.y = _rb.velocity.y * 1.03f; _moveVector += (Vector3.forward * -StripMovement.StripSpeed); _rb.velocity = _moveVector; } }
public void StartDeath() { _deathParticles.Play(); NoiseManager.PlaySound(this.gameObject, "car_fall" + Random.Range(1, 4)); StartCoroutine(CallAfterTime(.7f, onCarExplosion)); StartCoroutine(CallAfterTime(.7f, () => { _music.Explosion(); NoiseManager.PlaySound(this.gameObject, "car_explosion" + Random.Range(1, 3)); })); }
private IEnumerator MatchCountdown(int time) { CountdownTimerUI countdown = FindObjectOfType <CountdownTimerUI>(); // Wait 1 second before the match actually starts yield return(_countDownWait); NoiseManager.PlaySound(this.gameObject, "321GO"); for (int i = time; i > 0; i--) { onMatchStartTimer?.Invoke(i); yield return(_countDownWait); } countdown.Disable(); yield return(_countDownWait); Started = true; onMatchStart?.Invoke(); }