teleporter.cs 544 B

123456789101112131415161718
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using JetBrains.Annotations;
  4. using UnityEngine;
  5. public class teleporter : MonoBehaviour
  6. {
  7. public Transform teleportLocation;
  8. private void OnTriggerEnter2D(Collider2D other) {
  9. if(other.tag == "Player"){
  10. if(other.transform == playerNetwork.localPlayerTransform){
  11. other.transform.position = teleportLocation.position;
  12. cameraRPG.instance.Teleport(teleportLocation.position);
  13. }
  14. }
  15. }
  16. }