移除ECM2

This commit is contained in:
2025-05-11 21:42:51 +08:00
parent aadd564c38
commit a7bf033ca9
726 changed files with 0 additions and 138648 deletions

View File

@@ -1,68 +0,0 @@
using UnityEngine;
namespace ECM2.Examples.Teleport
{
/// <summary>
/// This example shows how to teleport a character and orient it (if enabled) towards a destination forward preserving its momentum.
/// </summary>
public class Teleporter : MonoBehaviour
{
[Tooltip("The destination teleporter.")]
public Teleporter destination;
[Tooltip("If true, the character will orient towards the destination Teleporter forward (yaw only)")]
public bool OrientWithDestination;
/// <summary>
/// Helps to prevent being instantly teleported back.
/// </summary>
public bool isTeleporterEnabled { get; set; } = true;
private void OnTriggerEnter(Collider other)
{
// If no destination or this teleporter is disabled, return
if (destination == null || !isTeleporterEnabled)
return;
if (other.TryGetComponent(out Character character))
{
// Teleport character
character.TeleportPosition(destination.transform.position);
// Disable destination teleporter until teleported character left it,
// otherwise will be teleported back in an infinite loop!
destination.isTeleporterEnabled = false;
// Should orient with destination ?
if (OrientWithDestination)
{
// Update character's rotation towards destination forward vector (yaw only)
Vector3 characterUp = character.GetUpVector();
Vector3 teleporterForward = destination.transform.forward.projectedOnPlane(characterUp);
Quaternion newRotation = Quaternion.LookRotation(teleporterForward, character.GetUpVector());
character.TeleportRotation(newRotation);
// Re-orient character's horizontal velocity along teleporter forward
character.LaunchCharacter(teleporterForward * character.GetSpeed(), false, true);
}
}
}
private void OnTriggerExit(Collider other)
{
// On left, make sure teleporter is re-enabled
isTeleporterEnabled = true;
}
}
}

View File

@@ -1,11 +0,0 @@
fileFormatVersion: 2
guid: 4dd6e1ccacd1ff74e9d99a46dca9bd8f
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: