private IEnumerator GhostRacerAction(int action, float time) { yield return(new WaitForSeconds(time)); if (ghostRacer == null) { yield return(null); } switch (action) { case GhostDataBundle.EventType.ThrottlePress: ghostRacer.StepOnGas(); break; case GhostDataBundle.EventType.ThrottleRelease: ghostRacer.ReleaseGas(); break; case GhostDataBundle.EventType.GearUp: ghostRacer.ShiftUp(); break; case GhostDataBundle.EventType.GearDown: ghostRacer.ShiftDown(); break; default: break; } yield return(null); }
public void SetupCar() { GameObject.FindObjectOfType <RS_GamePlayCamera>().FollowTarget = _player.transform; UIController.ButtonGasPressedEvent += delegate { _player.StepOnGas(); }; UIController.ButtonGasReleasedEvent += delegate() { _player.ReleaseGas(); }; UIController.ButtonGearUpEvent += GearUp; UIController.ButtonGearDownEvent += GearDown; UIController.ButtonRestartEvent += Restart; UIController.SetupUI(_player); UIController.StartTimer.StartCountDown(); UIController.StartTimer.OnCountDownFinished += delegate { LaunchEngines(); }; }