Fix some control issues
This commit is contained in:
@@ -102,6 +102,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
|
|
||||||
private bool _healthTimerActive = true;
|
private bool _healthTimerActive = true;
|
||||||
|
|
||||||
|
private bool _debugSprint = false;
|
||||||
|
|
||||||
private float _knockbackStrength = 0.0f;
|
private float _knockbackStrength = 0.0f;
|
||||||
private Vector3 _knockbackDirection = Vector3.Zero;
|
private Vector3 _knockbackDirection = Vector3.Zero;
|
||||||
|
|
||||||
@@ -242,9 +244,9 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
if (@event.IsActionPressed(GameInputs.Attack))
|
if (@event.IsActionPressed(GameInputs.Attack))
|
||||||
Attack();
|
Attack();
|
||||||
if (@event.IsActionPressed(GameInputs.Sprint))
|
if (@event.IsActionPressed(GameInputs.Sprint))
|
||||||
Settings.MoveSpeed *= 2;
|
_debugSprint = true;
|
||||||
if (@event.IsActionReleased(GameInputs.Sprint))
|
else if (@event.IsActionReleased(GameInputs.Sprint))
|
||||||
Settings.MoveSpeed /= 2;
|
_debugSprint = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void PlayTestAnimation()
|
public void PlayTestAnimation()
|
||||||
@@ -350,6 +352,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
|||||||
transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis;
|
transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis;
|
||||||
var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized();
|
var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized();
|
||||||
var velocity = Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration;
|
var velocity = Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration;
|
||||||
|
if (_debugSprint)
|
||||||
|
velocity *= 2;
|
||||||
_knockbackStrength *= 0.9f;
|
_knockbackStrength *= 0.9f;
|
||||||
Transform = Transform with { Basis = transform.Basis };
|
Transform = Transform with { Basis = transform.Basis };
|
||||||
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
||||||
|
|||||||
@@ -60,12 +60,6 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
|||||||
private IItemSlot _currentlySelectedItem = null;
|
private IItemSlot _currentlySelectedItem = null;
|
||||||
private bool _enableMenuSound = false;
|
private bool _enableMenuSound = false;
|
||||||
|
|
||||||
public override void _EnterTree()
|
|
||||||
{
|
|
||||||
SetProcessInput(false);
|
|
||||||
SetProcessUnhandledInput(false);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void OnResolved()
|
public void OnResolved()
|
||||||
{
|
{
|
||||||
ItemSlots = [ItemSlot1, ItemSlot2, ItemSlot3, ItemSlot4, ItemSlot5, ItemSlot6, ItemSlot7, ItemSlot8, ItemSlot9, ItemSlot10, ItemSlot11, ItemSlot12, ItemSlot13, ItemSlot14, ItemSlot15, ItemSlot16, ItemSlot17, ItemSlot18, ItemSlot19, ItemSlot20];
|
ItemSlots = [ItemSlot1, ItemSlot2, ItemSlot3, ItemSlot4, ItemSlot5, ItemSlot6, ItemSlot7, ItemSlot8, ItemSlot9, ItemSlot10, ItemSlot11, ItemSlot12, ItemSlot13, ItemSlot14, ItemSlot15, ItemSlot16, ItemSlot17, ItemSlot18, ItemSlot19, ItemSlot20];
|
||||||
@@ -93,6 +87,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
|||||||
DropButton.FocusEntered += ActionButtonFocusChanged;
|
DropButton.FocusEntered += ActionButtonFocusChanged;
|
||||||
|
|
||||||
VisibilityChanged += InventoryMenu_VisibilityChanged;
|
VisibilityChanged += InventoryMenu_VisibilityChanged;
|
||||||
|
SetProcessUnhandledInput(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ActionButtonFocusChanged()
|
private void ActionButtonFocusChanged()
|
||||||
|
|||||||
@@ -62,12 +62,6 @@ public partial class LoadNextLevel : Control, IFloorClearMenu
|
|||||||
ExitButton.Pressed += ExitButton_Pressed;
|
ExitButton.Pressed += ExitButton_Pressed;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override void _Input(InputEvent @event)
|
|
||||||
{
|
|
||||||
if (_fadingIn)
|
|
||||||
GetViewport().SetInputAsHandled();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void CurrentFloorNumber_Sync(int _) => FloorNumber.Text = _map.CurrentFloorNumber.Value.ToString("D2");
|
private void CurrentFloorNumber_Sync(int _) => FloorNumber.Text = _map.CurrentFloorNumber.Value.ToString("D2");
|
||||||
|
|
||||||
private void EquipmentComponent_EquipmentChanged(EquipableItem obj)
|
private void EquipmentComponent_EquipmentChanged(EquipableItem obj)
|
||||||
|
|||||||
Reference in New Issue
Block a user