Nuclear gun and 3D tests

This commit is contained in:
MaddoScientisto 2025-03-22 00:33:24 +01:00
commit d1d3a3fdd5
34 changed files with 750 additions and 55 deletions

View file

@ -1,4 +1,6 @@
using Godot;
using System;
using System.Threading.Tasks;
using Godot;
namespace Cirno.Scripts.Components.Actors;
@ -36,6 +38,35 @@ public partial class KeyboardInputProvider : InputProvider
private enum AimInputMethod { RightStick, Mouse }
private AimInputMethod _lastUsedInput = AimInputMethod.RightStick;
public override void _Ready()
{
CallDeferred(MethodName.DelayedRegisterGameManager);
}
private void DelayedRegisterGameManager()
{
GameManager.Instance.GameStateChange += InstanceOnGameStateChange;
_enabled = true;
}
private bool _enabled = false;
private void InstanceOnGameStateChange(GameState state)
{
if (state is not GameState.Playing) return;
_enabled = false;
_ = DelayResume();
}
private async Task DelayResume()
{
//await ToSignal(GetTree(), SceneTree.SignalName.ProcessFrame);
await Task.Delay(200);
_enabled = true;
}
public override Vector2 GetMovementInput()
{
@ -96,7 +127,7 @@ public partial class KeyboardInputProvider : InputProvider
public override bool GetShootPressed()
{
return GetActionPressed(_shootActionName);
return _enabled && GetActionPressed(_shootActionName);
}
public override bool GetShootJustPressed()