Пример #1
0
    private void StartCar()
    {
        //activate vehicle scripts
        _carController.canControl = true;
        _carController.StartEngine();

        //update player movement scripts
        playerInteraction.busy = false;
        playerInteraction.playerNav.enabled = false;

        //tell driving cameras to follow new player vehicle
        playerInteraction.cameraBrain.enabled = true;
        driveCam          = playerInteraction.driveCam;
        inCarCam          = playerInteraction.inCarCam;
        driveCam.LookAt   = this.transform;
        driveCam.Follow   = this.transform;
        driveCam.Priority = 11;
        inCarCam.LookAt   = this.transform;
        inCarCam.Follow   = this.transform;

        if (_siren != null)
        {
            _siren.enabled = true;
        }
    }
Пример #2
0
 public void ContinueAdsForTimeCheckpoint()
 {
     losePanel.SetActive(false);
     curr = 25;
     carController.StartEngine();
     count = 0;
     StopAllCoroutines();
 }
Пример #3
0
    void OnEnable()
    {
        OnPlayerSpawned(this);

        if (!carController.engineRunning)
        {
            carController.StartEngine();
        }
    }
Пример #4
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();
     }
 }
Пример #5
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);
    }