26 lines
436 B
C#
26 lines
436 B
C#
using UnityEngine;
|
|
|
|
public class Teleport : MonoBehaviour
|
|
{
|
|
public Transform player;
|
|
|
|
public Transform destination;
|
|
|
|
public GameObject fpsPlayer;
|
|
|
|
private void Update()
|
|
{
|
|
}
|
|
|
|
private void OnTriggerEnter(Collider other)
|
|
{
|
|
if (other.CompareTag("Player"))
|
|
{
|
|
fpsPlayer.SetActive(value: false);
|
|
player.position = destination.position;
|
|
player.rotation = destination.rotation;
|
|
fpsPlayer.SetActive(value: true);
|
|
}
|
|
}
|
|
}
|