mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-01 11:15:33 +00:00
Nuclear gun and 3D tests
This commit is contained in:
parent
9d065a6f2b
commit
d1d3a3fdd5
34 changed files with 750 additions and 55 deletions
|
|
@ -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()
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue