/// <summary> /// Hook player trigger events. /// </summary> /// <param name="fsm">Player trigger FSM on vehicle drivers seat.</param> void PlayerEventHooks(PlayMakerFSM fsm) { // Temp - use player trigger. (No idea what this comment meant, it's now many months later. :P) // It's now 6+ months later, no idea what this means at all now. :p -Curtis EventHook.Add(fsm, "Player in car", new Func <bool>(() => { if (CurrentDrivingState == DrivingStates.Driver && !DriverIsLocal) { return(true); } else { CurrentDrivingState = DrivingStates.Driver; DriverIsLocal = true; SetRemoteSteering(false); Network.NetLocalPlayer.Instance.EnterVehicle(syncComponent, false); return(false); } })); EventHook.Add(fsm, "Wait for player", new Func <bool>(() => { if (CurrentDrivingState == DrivingStates.Driver && DriverIsLocal) { CurrentDrivingState = DrivingStates.None; DriverIsLocal = false; Network.NetLocalPlayer.Instance.LeaveVehicle(); } return(false); })); SeatTransform = fsm.gameObject.transform; if (SeatTransform.gameObject.name == "DriveTrigger" && !ParentGameObject.name.StartsWith("JONNEZ") && !ParentGameObject.name.StartsWith("KEKMET")) { AddPassengerSeat(fsm); } }
/// <summary> /// function that handles our Accelerate state /// </summary> public void HandleAccelrateState() { if (currentDrivingState == DrivingStates.Accelerate) { return; } if (currentDrivingState != DrivingStates.Accelerate) { currentDrivingState = DrivingStates.Accelerate; // set the current driving state to equal the Driving State Accelerate m_Accelleration = 5f; // set the acceleration value to 5f wheelDampening = 250f; } }
/// <summary> /// function that handles our Brake state /// </summary> public void HandleBrakeState() { if (currentDrivingState == DrivingStates.Brake) { return; } if (currentDrivingState != DrivingStates.Brake) { currentDrivingState = DrivingStates.Brake; // set the current driving state to equal the Driving State Brake m_Accelleration = -5f; // set the acceleration value to -5f wheelDampening = 10000f; } }
/// <summary> /// function that handles our Idle state /// </summary> public void HandleIdleState() { if (gameManager.usingCarBlue == false) { return; } if (currentDrivingState == DrivingStates.Idle) // if the current driving state is equal to the Driving State Idle { return; } if (currentDrivingState != DrivingStates.Idle) { currentDrivingState = DrivingStates.Idle; m_Accelleration = 0f; // set the acceleration value to 0f m_Steering = 0f; // set the steering value to 0f wheelDampening = 500f; } }