Advertisement
jyourman

Untitled

Aug 28th, 2015
146
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3.  
  4. public class Respawn : MonoBehaviour {
  5. public GameObject Platform;
  6. public GameObject Text;
  7. public TimerScript;
  8.  
  9. // Use this for initialization
  10. void Start ()
  11. {
  12. GameObject Text = GameObject.Find("Text");
  13. TimerScript = Text.GetComponent<TimerController>();
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update () {
  18. if(transform.position.y < -2f) {
  19. transform.position = new Vector3(0, 2, 0);
  20. transform.rotation = Quaternion.identity;
  21. Rigidbody playerRigid = gameObject.GetComponent<Rigidbody>();
  22. playerRigid.velocity = Vector3.zero;
  23. playerRigid.angularVelocity = Vector3.zero;
  24. Platform.transform.rotation = Quaternion.identity;
  25. Platform.GetComponent<Rigidbody>().angularVelocity = Vector3.zero;
  26. TimerScript.remainingTime -= 5.0f;
  27. }
  28. }
  29. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement