This commit is contained in:
MrTorex committed 2026-02-18 20:13:09 +03:00
1 parent 0d5e6b6dec
commit c12d653cbc
647 files changed
+194585 -117

No files matched your search

@@ -0,0 +1,37 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Events;
using KinematicCharacterController.Examples;
namespace KinematicCharacterController.Examples
{
public class Teleporter : MonoBehaviour
{
public Teleporter TeleportTo;
public UnityAction<ExampleCharacterController> OnCharacterTeleport;
public bool isBeingTeleportedTo { get; set; }
private void OnTriggerEnter(Collider other)
{
if (!isBeingTeleportedTo)
{
ExampleCharacterController cc = other.GetComponent<ExampleCharacterController>();
if (cc)
{
cc.Motor.SetPositionAndRotation(TeleportTo.transform.position, TeleportTo.transform.rotation);
if (OnCharacterTeleport != null)
{
OnCharacterTeleport(cc);
}
TeleportTo.isBeingTeleportedTo = true;
}
}
isBeingTeleportedTo = false;
}
}
}