Advertisement
Guest User

Untitled

a guest
Feb 22nd, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. using System.Collections;
  2. using System;
  3. using System.Collections.Generic;
  4. using System.Linq;
  5. using System.Text.RegularExpressions;
  6. using UnityEngine;
  7.  
  8. public class teleport : MonoBehaviour {
  9.  
  10. // Use this for initialization
  11. void Start () {
  12. /* Confirm that the script is loaded */
  13. Console.WriteLine("Loaded teleport Script");
  14. }
  15.  
  16. // Update is called once per frame
  17. void Update () {
  18. Console.WriteLine("Frame Sent");
  19. }
  20. //Destination position
  21. public GameObject Destination;
  22.  
  23. // When trigger is triggered
  24. void OnTriggerEnter(Collider other) {
  25. Console.WriteLine("Collition detected");
  26. // If the trigger detects the player
  27. if (other.gameObject.tag == "Player")
  28. // Move Player to Destination position
  29. other.transform.position = Destination.transform.position;
  30. }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement