移除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,47 +0,0 @@
using ECM2.Examples.FirstPerson;
using UnityEngine;
namespace ECM2.Examples.FirstPersonFly
{
/// <summary>
/// Regular First Person Character Input. Shows how to handle movement while flying.
/// In this case, we allow to fly towards our view direction, allowing to freely move through the air.
/// </summary>
public class FirstPersonFlyInput : FirstPersonInput
{
protected override void HandleInput()
{
// Call base method implementation
base.HandleInput();
if (character.IsFlying())
{
// Movement when Flying
Vector2 movementInput = GetMovementInput();
Vector3 movementDirection = Vector3.zero;
// Strafe
movementDirection += character.GetRightVector() * movementInput.x;
// Forward, along camera view direction (if any) or along character's forward if camera not found
Vector3 forward = character.camera
? character.cameraTransform.forward
: character.GetForwardVector();
movementDirection += forward * movementInput.y;
// Vertical movement
if (character.jumpInputPressed)
movementDirection += Vector3.up;
character.SetMovementDirection(movementDirection);
}
}
}
}

View File

@@ -1,2 +0,0 @@
fileFormatVersion: 2
guid: cbbf3b9b979aa9d46901c3742b3c1230

View File

@@ -1,85 +0,0 @@
using UnityEngine;
namespace ECM2.Examples.FirstPersonFly
{
/// <summary>
/// This example shows how to extend a Character (through composition) and use
/// its Flying movement mode to implement a fly ability.
///
/// Flying movement mode needs to be manually enabled / disabled as needed.
/// </summary>
public class FlyAbility : MonoBehaviour
{
public bool canEverFly = true;
private Character _character;
/// <summary>
/// Determines if the Character is able to fly in its current state.
/// </summary>
private bool IsFlyAllowed()
{
return canEverFly && _character.IsFalling();
}
/// <summary>
/// Determines if the character should enter flying movement mode.
/// </summary>
protected virtual bool CanFly()
{
bool isFlyAllowed = IsFlyAllowed();
if (isFlyAllowed)
{
// If Fly is allowed, determine if is falling down otherwise its a jump!
Vector3 worldUp = -_character.GetGravityDirection();
float verticalSpeed = Vector3.Dot(_character.GetVelocity(), worldUp);
isFlyAllowed = verticalSpeed < 0.0f;
}
return isFlyAllowed;
}
private void OnCollided(ref CollisionResult collisionResult)
{
// If flying and collided with walkable ground, exit flying state.
// I.e: Change to Falling movement mode as this is managed based on grounding status.
if (_character.IsFlying() && collisionResult.isWalkable)
_character.SetMovementMode(Character.MovementMode.Falling);
}
private void OnBeforeSimulationUpdated(float deltaTime)
{
// Attempts to enter Flying movement mode
bool isFlying = _character.IsFlying();
bool wantsToFly = _character.jumpInputPressed;
if (!isFlying && wantsToFly && CanFly())
_character.SetMovementMode(Character.MovementMode.Flying);
}
private void Awake()
{
_character = GetComponent<Character>();
}
private void OnEnable()
{
_character.Collided += OnCollided;
_character.BeforeSimulationUpdated += OnBeforeSimulationUpdated;
}
private void OnDisable()
{
_character.Collided -= OnCollided;
_character.BeforeSimulationUpdated -= OnBeforeSimulationUpdated;
}
}
}

View File

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