Skip to content

Instantly share code, notes, and snippets.

@jquave
Created October 4, 2013 18:51
Show Gist options
  • Select an option

  • Save jquave/6830801 to your computer and use it in GitHub Desktop.

Select an option

Save jquave/6830801 to your computer and use it in GitHub Desktop.
void DeactivateVehicle() {
isRunning = false;
HumanPlayer hp = FindObjectOfType(typeof(HumanPlayer)) as HumanPlayer;
hp.Respawn(transform.position+2*Vector3.up);
hp.rigidbody.velocity = 2*transform.eulerAngles;
// Stop it's movement
constantForce.enabled = false;
// Switch to vehicle camera
Camera.mainCamera.GetComponent<SmoothLookAt>().enabled = true;
Camera.mainCamera.GetComponent<MouseOrbit>().enabled = false;
// Target the vehicle
Camera.mainCamera.GetComponent<SmoothLookAt>().target = hp.transform;
// Enable the controls
//vehicle.GetComponent<Runner>().enabled = true;
//humanPlayer.transform.position = new Vector3(0,-10000,0);
enabled = false;
DisplayMessage("Get in a car!!!");
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment