Advertisement
KorolevDmitry123

Untitled

Apr 9th, 2016
106
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class TeleportBlueBall : MonoBehaviour
  4. {
  5. public bool teleported = false;
  6. public TeleportBlueBall target;
  7.  
  8. void OnTriggerEnter(Collider other)
  9. {
  10. if (other.CompareTag("BlueBall"))
  11. {
  12. if (!teleported)
  13. {
  14. target.teleported = true; other.gameObject.transform.position = target.gameObject.transform.position;
  15. }
  16. }
  17. }
  18.  
  19. void OnTriggerExit(Collider other)
  20. {
  21. if (other.CompareTag("BlueBall"))
  22. {
  23. teleported = false;
  24. }
  25. }
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement