Add Movement library integration with comprehensive test environment: include Movement.csproj reference, create LibraryTest scene with player controller, multiple test areas (bunny hop platforms, surf ramps, vertical tower, speed corridor), advanced lighting setup, input mappings for WASD/gamepad movement controls, and DebugHUD integration
This commit is contained in:
74
Scripts/Testing/TestGameManager.cs
Normal file
74
Scripts/Testing/TestGameManager.cs
Normal file
@@ -0,0 +1,74 @@
|
||||
using EinSoftworks.Events;
|
||||
using EinSoftworks.Input;
|
||||
using EinSoftworks.Movement;
|
||||
using Godot;
|
||||
using Voider.Player;
|
||||
|
||||
namespace Voider.Testing;
|
||||
|
||||
public partial class TestGameManager : Node
|
||||
{
|
||||
[Export]
|
||||
public Label InfoLabel { get; set; }
|
||||
|
||||
[Export]
|
||||
public Player.Player Player { get; set; }
|
||||
|
||||
private InputManager _inputManager;
|
||||
private float _gameTime = 0f;
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
// InputManager is initialized by the library itself
|
||||
_inputManager = InputManager.Instance;
|
||||
|
||||
MovementEvents.StateChanged += OnStateChanged;
|
||||
MovementEvents.PlayerJumped += OnPlayerJumped;
|
||||
|
||||
if (InfoLabel != null)
|
||||
{
|
||||
InfoLabel.Text =
|
||||
"Library Integration Test\nPress ESC to toggle mouse capture\nWASD to move, Space to jump, Shift to sprint, Ctrl to crouch";
|
||||
}
|
||||
|
||||
GD.Print("=== Library Integration Test Started ===");
|
||||
GD.Print("All EinSoftworks libraries loaded successfully!");
|
||||
}
|
||||
|
||||
public override void _Process(double delta)
|
||||
{
|
||||
_gameTime += (float)delta;
|
||||
|
||||
if (_inputManager != null && _inputManager.IsActionJustPressed("ui_home"))
|
||||
{
|
||||
ResetPlayer();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnStateChanged(string state)
|
||||
{
|
||||
GD.Print($"[GameManager] Movement state: {state}");
|
||||
}
|
||||
|
||||
private void OnPlayerJumped()
|
||||
{
|
||||
GD.Print($"[GameManager] Player jumped at time: {_gameTime:F2}s");
|
||||
}
|
||||
|
||||
private void ResetPlayer()
|
||||
{
|
||||
if (Player != null)
|
||||
{
|
||||
Player.GlobalPosition = new Vector3(0, 2, 0);
|
||||
Player.Velocity = Vector3.Zero;
|
||||
GD.Print("Player reset to spawn position");
|
||||
}
|
||||
}
|
||||
|
||||
public override void _ExitTree()
|
||||
{
|
||||
MovementEvents.StateChanged -= OnStateChanged;
|
||||
MovementEvents.PlayerJumped -= OnPlayerJumped;
|
||||
MovementEvents.ClearAllSubscriptions();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user