Example #1
0
 ///<summary>
 /// Sets engine state of the vehicle.
 ///</summary>
 public static void SetEngine(RCC_CarControllerV3 vehicle, bool engineState)
 {
     if (engineState)
     {
         vehicle.StartEngine();
     }
     else
     {
         vehicle.KillEngine();
     }
 }
    public void StopCar()
    {
        //***if speed > 'x' need to apply brake when exiting then eject player after timer

        //switch camera back to locomotion cam handled via anim controller/cinemachine state driven cam
        _driverDoorAnim.SetTrigger("OpenDoor");
        //_driverDoorAnim.ResetTrigger("OpenDoor");
        playerAnim.SetBool("isDriving", false);
        isDriving = false;
        exiting   = true;
        _carController.canControl = false;
        _carController.KillEngine();
    }
Example #3
0
    ///<summary>
    /// Spawn a RCC vehicle prefab with given position, rotation, sets its controllable, and engine state.
    ///</summary>
    public static RCC_CarControllerV3 SpawnRCC(RCC_CarControllerV3 vehiclePrefab, Vector3 position, Quaternion rotation, bool registerAsPlayerVehicle, bool isControllable, bool isEngineRunning)
    {
        RCC_CarControllerV3 spawnedRCC = (RCC_CarControllerV3)GameObject.Instantiate(vehiclePrefab, position, rotation);

        spawnedRCC.gameObject.SetActive(true);
        spawnedRCC.SetCanControl(isControllable);

        if (registerAsPlayerVehicle)
        {
            RCC_SceneManager.Instance.RegisterPlayer(spawnedRCC);
        }

        if (isEngineRunning)
        {
            spawnedRCC.StartEngine(true);
        }
        else
        {
            spawnedRCC.KillEngine();
        }

        return(spawnedRCC);
    }