mirror of
https://gitlab.com/MaddoScientisto/cirnogodot.git
synced 2026-06-07 14:15:54 +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()
|
||||
|
|
|
|||
|
|
@ -328,15 +328,24 @@ public partial class GameManager : Node2D
|
|||
case GameState.Playing:
|
||||
case GameState.Controlling:
|
||||
//Input.MouseMode = Input.MouseModeEnum.Confined;
|
||||
GetTree().SetPause(false);
|
||||
DelayedUnpause();
|
||||
//CallDeferred(MethodName.DelayedUnpause);
|
||||
//GetTree().SetPause(false);
|
||||
break;
|
||||
case GameState.Menu:
|
||||
//Input.MouseMode = Input.MouseModeEnum.Visible;
|
||||
GetTree().SetPause(false);
|
||||
DelayedUnpause();
|
||||
//CallDeferred(MethodName.DelayedUnpause);
|
||||
//GetTree().SetPause(false);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void DelayedUnpause()
|
||||
{
|
||||
GetTree().SetPause(false);
|
||||
}
|
||||
|
||||
public void ClearBullets()
|
||||
{
|
||||
if (_bulletsContainer is null) return;
|
||||
|
|
|
|||
12
Scripts/TestRotation3D.cs
Normal file
12
Scripts/TestRotation3D.cs
Normal file
|
|
@ -0,0 +1,12 @@
|
|||
using Godot;
|
||||
using System;
|
||||
|
||||
public partial class TestRotation3D : Node3D
|
||||
{
|
||||
[Export] public float RotationSpeed = 1f;
|
||||
|
||||
public override void _PhysicsProcess(double delta)
|
||||
{
|
||||
this.RotateY(Mathf.DegToRad(RotationSpeed));
|
||||
}
|
||||
}
|
||||
1
Scripts/TestRotation3D.cs.uid
Normal file
1
Scripts/TestRotation3D.cs.uid
Normal file
|
|
@ -0,0 +1 @@
|
|||
uid://q44rbbdjx75v
|
||||
Loading…
Add table
Add a link
Reference in a new issue