Ended with remapping and removed old junk
This commit is contained in:
@@ -129,22 +129,10 @@ public partial class PlayerController : CharacterBody3D
|
||||
[Export(PropertyHint.Range, "1,10,0.1,or_greater")]
|
||||
public float DoubleJumpGravityLesseningFactor { get; set; } = 3f;
|
||||
|
||||
|
||||
// Mega jump
|
||||
[ExportSubgroup("Mega jump")]
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
public float MegaJumpStartVelocity { get; set; } = 10.0f;
|
||||
[Export(PropertyHint.Range, "0,10,1,or_greater")]
|
||||
public int MegaJumpHangTimeInFrames { get; set; } = 5;
|
||||
[Export(PropertyHint.Range, "1,10,0.1,or_greater")]
|
||||
public float MegaJumpGravityLesseningFactor { get; set; } = 3f;
|
||||
|
||||
// Wall jump
|
||||
[ExportSubgroup("Wall jump")]
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
public float WallJumpStartVelocity { get; set; } = 10.0f;
|
||||
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||
public float WallMegajumpStartVelocity { get; set; } = 20.0f;
|
||||
|
||||
// Dash
|
||||
[ExportGroup("Dash")]
|
||||
@@ -154,12 +142,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
[ExportSubgroup("Simple")]
|
||||
[Export(PropertyHint.Range, "0,50,0.1")]
|
||||
public float SimpleDashStrength { get; set; } = 10f;
|
||||
// Powered Dash
|
||||
[ExportSubgroup("Powered")]
|
||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||
public float PoweredDashTime { get; set; } = 0.3f;
|
||||
[Export(PropertyHint.Range, "0,100,0.1")]
|
||||
public float PoweredDashStrength { get; set; } = 10f;
|
||||
// Aimed Dash
|
||||
[ExportSubgroup("Special")]
|
||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||
@@ -217,7 +199,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
private StateChart _playerState;
|
||||
|
||||
private StateChartState _aiming;
|
||||
private StateChartState _empowerOn;
|
||||
private StateChartState _powerExpired;
|
||||
private StateChartState _powerRecharging;
|
||||
private StateChartState _powerFull;
|
||||
@@ -227,25 +208,15 @@ public partial class PlayerController : CharacterBody3D
|
||||
private StateChartState _coyoteEnabled;
|
||||
private StateChartState _simpleJump;
|
||||
private StateChartState _doubleJump;
|
||||
private StateChartState _megaJump;
|
||||
private StateChartState _mantling;
|
||||
private StateChartState _simpleDash;
|
||||
private StateChartState _poweredDash;
|
||||
private StateChartState _aimedDash;
|
||||
private StateChartState _onWall;
|
||||
private StateChartState _onWallHugging;
|
||||
private StateChartState _onWallHuggingCoyoteEnabled;
|
||||
private StateChartState _onWallHanging;
|
||||
private StateChartState _onWallRunning;
|
||||
private StateChartState _onWallRunningCoyoteEnabled;
|
||||
|
||||
private Transition _onJumpFromWallCoyote;
|
||||
private Transition _onJumpFromWallRunCoyote;
|
||||
private Transition _onJumpFromWall1;
|
||||
private Transition _onJumpFromWall2;
|
||||
private Transition _onJumpFromWall3;
|
||||
private Transition _onMegajumpFromWall;
|
||||
private Transition _onLeaveWallFromRunCoyote;
|
||||
private Transition _onJumpFromWall;
|
||||
private Transition _onLeaveWallFromRun;
|
||||
|
||||
private int _currentInputBufferFrames;
|
||||
@@ -316,10 +287,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
_aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On"));
|
||||
_simpleDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/Dash"));
|
||||
_poweredDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/PoweredDash"));
|
||||
_aimedDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/AimedDash"));
|
||||
// _actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||
_empowerOn = StateChartState.Of(GetNode("StateChart/Root/Empower/On"));
|
||||
_powerExpired = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Expired"));
|
||||
_powerRecharging = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/AtLeastOneCharge"));
|
||||
_powerFull = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Full"));
|
||||
@@ -330,22 +299,13 @@ public partial class PlayerController : CharacterBody3D
|
||||
// _doubleJumpEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/DoubleJumpEnabled"));
|
||||
_simpleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/SimpleJump"));
|
||||
_doubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/DoubleJump"));
|
||||
_megaJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/MegaJump"));
|
||||
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
||||
_onJumpFromWallCoyote = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/HuggingCoyoteEnabled/OnJump"));
|
||||
_onJumpFromWallRunCoyote = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/RunningCoyoteEnabled/OnJump"));
|
||||
_onJumpFromWall1 = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging/OnJump"));
|
||||
_onJumpFromWall2 = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging/OnJump"));
|
||||
_onJumpFromWall3 = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Running/OnJump"));
|
||||
_onMegajumpFromWall = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/OnMegajump"));
|
||||
_onJumpFromWall = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/OnJump"));
|
||||
_onWall = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall"));
|
||||
_onWallHuggingCoyoteEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/HuggingCoyoteEnabled"));
|
||||
_onWallHugging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging"));
|
||||
_onWallHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging"));
|
||||
_onWallRunning = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Running"));
|
||||
_onWallRunningCoyoteEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/RunningCoyoteEnabled"));
|
||||
_onLeaveWallFromRun = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/Running/OnLeaveWall"));
|
||||
_onLeaveWallFromRunCoyote = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/RunningCoyoteEnabled/OnLeaveWall"));
|
||||
// State timers
|
||||
_powerCooldownTimer = GetNode<Timer>("PowerCooldown");
|
||||
_timeScaleAimInAirTimer = GetNode<Timer>("TimeScaleAimInAir");
|
||||
@@ -405,18 +365,11 @@ public partial class PlayerController : CharacterBody3D
|
||||
_doubleJump.StateEntered += OnDoubleJumpStarted;
|
||||
_doubleJump.StatePhysicsProcessing += HandleDoubleJump;
|
||||
|
||||
_megaJump.StateEntered += OnMegaJumpStarted;
|
||||
_megaJump.StatePhysicsProcessing += HandleMegaJump;
|
||||
|
||||
_mantling.StateEntered += OnMantleStarted;
|
||||
_mantling.StatePhysicsProcessing += HandleMantling;
|
||||
|
||||
_simpleDash.StateEntered += OnSimpleDashStarted;
|
||||
_simpleDash.StatePhysicsProcessing += HandleSimpleDash;
|
||||
|
||||
_poweredDash.StateEntered += OnPoweredDashStarted;
|
||||
_poweredDash.StatePhysicsProcessing += HandlePoweredDash;
|
||||
_poweredDash.StateExited += OnPoweredDashFinished;
|
||||
|
||||
_aimedDash.StateEntered += OnAimedDashStarted;
|
||||
_aimedDash.StateExited += OnAimedDashFinished;
|
||||
@@ -426,33 +379,14 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
_onWall.StateEntered += OnWallStarted;
|
||||
_onWall.StateExited += OnWallStopped;
|
||||
_onWallHuggingCoyoteEnabled.StateEntered += OnWallHuggingStarted;
|
||||
_onWallHuggingCoyoteEnabled.StatePhysicsProcessing += HandleWallHugging;
|
||||
_onWallHugging.StatePhysicsProcessing += HandleWallHugging;
|
||||
_onWallHanging.StatePhysicsProcessing += HandleWallHanging;
|
||||
_onWallRunningCoyoteEnabled.StateEntered += OnWallRunningStarted;
|
||||
_onWallRunningCoyoteEnabled.StatePhysicsProcessing += HandleWallRunning;
|
||||
_onWallRunning.StatePhysicsProcessing += HandleWallRunning;
|
||||
|
||||
_onJumpFromWallCoyote.Taken += OnJumpFromWallCoyote;
|
||||
_onJumpFromWallRunCoyote.Taken += OnJumpFromWallCoyote;
|
||||
_onJumpFromWall1.Taken += OnJumpFromWall;
|
||||
_onJumpFromWall2.Taken += OnJumpFromWall;
|
||||
_onJumpFromWall3.Taken += OnJumpFromWall;
|
||||
_onMegajumpFromWall.Taken += OnMegajumpFromWall;
|
||||
_onJumpFromWall.Taken += OnJumpFromWall;
|
||||
_onLeaveWallFromRun.Taken += OnLeaveWallFromRun;
|
||||
_onLeaveWallFromRunCoyote.Taken += OnLeaveWallFromRun;
|
||||
}
|
||||
|
||||
public void OnGroundDetected(Node3D _)
|
||||
{
|
||||
GD.Print("Ground-like");
|
||||
}
|
||||
public void OnGroundLost(Node3D _)
|
||||
{
|
||||
GD.Print("Ground-less");
|
||||
}
|
||||
|
||||
|
||||
public void SetAllowedInputsAll()
|
||||
{
|
||||
CurrentlyAllowedInputs = AllowedInputs.All;
|
||||
@@ -595,20 +529,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
||||
}
|
||||
|
||||
public void OnWallHuggingStarted()
|
||||
{
|
||||
GetTree().CreateTimer(CoyoteTime).Timeout += CoyoteExpired;
|
||||
}
|
||||
|
||||
public void OnWallRunningStarted()
|
||||
{
|
||||
GetTree().CreateTimer(CoyoteTime).Timeout += CoyoteExpired;
|
||||
}
|
||||
|
||||
public void OnWallDetected()
|
||||
{
|
||||
FinishPoweredDash();
|
||||
|
||||
if (!_onWall.Active)
|
||||
return;
|
||||
|
||||
@@ -713,12 +635,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
return;
|
||||
}
|
||||
|
||||
if (_empowerOn.Active && CanPerformEmpoweredAction())
|
||||
{
|
||||
_playerState.SendEvent("megajump");
|
||||
return;
|
||||
}
|
||||
|
||||
_playerState.SendEvent("jump");
|
||||
}
|
||||
|
||||
@@ -752,11 +668,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
// _canDashAirborne = true;
|
||||
OnJumpStarted(DoubleJumpStartVelocity);
|
||||
}
|
||||
public void OnMegaJumpStarted()
|
||||
{
|
||||
PerformEmpoweredAction();
|
||||
OnJumpStarted(MegaJumpStartVelocity);
|
||||
}
|
||||
|
||||
public void ComputeJumpFromWallHSpeed(float jumpStrength)
|
||||
{
|
||||
@@ -773,11 +684,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
SetHorizontalVelocity(currentHorizontalVelocity + wallJumpHorizontalVelocity);
|
||||
}
|
||||
|
||||
public void OnJumpFromWallCoyote()
|
||||
{
|
||||
_isWallJumpAvailable = false;
|
||||
}
|
||||
|
||||
public void OnJumpFromWall()
|
||||
{
|
||||
@@ -790,9 +696,15 @@ public partial class PlayerController : CharacterBody3D
|
||||
_airborneDashCooldownTimer.Start();
|
||||
_isWallJumpAvailable = false;
|
||||
}
|
||||
public void OnMegajumpFromWall()
|
||||
|
||||
public void OnInputSlideStarted()
|
||||
{
|
||||
}
|
||||
public void OnInputSlideOngoing()
|
||||
{
|
||||
}
|
||||
public void OnInputSlideEnded()
|
||||
{
|
||||
ComputeJumpFromWallHSpeed(WallMegajumpStartVelocity);
|
||||
}
|
||||
|
||||
public void InputDeviceChanged(bool isUsingGamepad)
|
||||
@@ -963,10 +875,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
HandleJump(delta, DoubleJumpGravityLesseningFactor, DoubleJumpHangTimeInFrames);
|
||||
}
|
||||
public void HandleMegaJump(float delta)
|
||||
{
|
||||
HandleJump(delta, MegaJumpGravityLesseningFactor, MegaJumpHangTimeInFrames);
|
||||
}
|
||||
|
||||
public void PowerRecharging(float delta)
|
||||
{
|
||||
@@ -1035,14 +943,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
ThrowWeapon();
|
||||
}
|
||||
}
|
||||
public void OnInputEmpowerDown()
|
||||
{
|
||||
// _playerState.SendEvent("empower_down");
|
||||
}
|
||||
public void OnInputEmpowerReleased()
|
||||
{
|
||||
// _playerState.SendEvent("empower_released");
|
||||
}
|
||||
public void OnInputDashPressed()
|
||||
{
|
||||
if (_aiming.Active && CanPerformEmpoweredAction())
|
||||
@@ -1052,12 +952,6 @@ public partial class PlayerController : CharacterBody3D
|
||||
_playerState.SendEvent("cancel_aim");
|
||||
return;
|
||||
}
|
||||
if (_empowerOn.Active && CanPerformEmpoweredAction())
|
||||
{
|
||||
PerformEmpoweredAction();
|
||||
_playerState.SendEvent("powered_dash");
|
||||
return;
|
||||
}
|
||||
|
||||
if (_airborne.Active)
|
||||
{
|
||||
@@ -1070,11 +964,14 @@ public partial class PlayerController : CharacterBody3D
|
||||
_bufferedAction = _mantling.Active ? BufferedActions.MantleDash : BufferedActions.Dash;
|
||||
_playerState.SendEvent("dash");
|
||||
}
|
||||
public void OnAimingEntered()
|
||||
|
||||
public void OnInputSlamPressed()
|
||||
{
|
||||
GD.Print("Slam pressed");
|
||||
}
|
||||
|
||||
public void OnInputParryPressed()
|
||||
{
|
||||
if (!CanPerformEmpoweredAction())
|
||||
return;
|
||||
|
||||
if (WeaponSystem.FlyingState.Active)
|
||||
{
|
||||
DashToFlyingWeapon();
|
||||
@@ -1086,10 +983,14 @@ public partial class PlayerController : CharacterBody3D
|
||||
DashToPlantedWeapon();
|
||||
return;
|
||||
}
|
||||
}
|
||||
public void OnAimingEntered()
|
||||
{
|
||||
if (!CanPerformEmpoweredAction())
|
||||
return;
|
||||
|
||||
DashSystem.StartPreparingDash();
|
||||
DashIndicatorMesh.Visible = true;
|
||||
|
||||
if (!isOnFloorCustom())
|
||||
ReduceTimeScaleWhileAiming();
|
||||
}
|
||||
@@ -1280,31 +1181,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
var direction = GetMoveInput();
|
||||
return new Vector3(direction.X, 0, direction.Z).Normalized();
|
||||
}
|
||||
|
||||
public void OnPoweredDashStarted()
|
||||
{
|
||||
Velocity = GetInputGlobalHDirection() * PoweredDashStrength;
|
||||
GetTree().CreateTimer(PoweredDashTime).Timeout += FinishPoweredDash;
|
||||
}
|
||||
|
||||
public void OnPoweredDashFinished()
|
||||
{
|
||||
}
|
||||
|
||||
public void FinishPoweredDash()
|
||||
{
|
||||
_playerState.SendEvent("dash_finished");
|
||||
}
|
||||
|
||||
public void HandlePoweredDash(float delta)
|
||||
{
|
||||
var collision = MoveAndCollide(Velocity * delta, maxCollisions: 10);
|
||||
if (collision != null)
|
||||
{
|
||||
FinishPoweredDash();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public bool CanPerformEmpoweredAction()
|
||||
{
|
||||
return EmpoweredActionsLeft > 0 && TutorialDone;
|
||||
@@ -1334,7 +1211,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
Vector2 inputLookDir = new Vector2(_inputRotateY, _inputRotateFloorplane);
|
||||
var lookSensitivity = _isUsingGamepad ? _lookSensitivityMultiplier : _mouseSensitivityMultiplier;
|
||||
|
||||
var wallHugContactPoint = _onWallRunning.Active || _onWallRunningCoyoteEnabled.Active ? _currentWallContactPoint : Vector3.Zero;
|
||||
var wallHugContactPoint = _onWallRunning.Active ? _currentWallContactPoint : Vector3.Zero;
|
||||
var playerVelocity = GetGlobalMoveInput();
|
||||
HeadSystem.LookAround(delta, inputLookDir, playerVelocity, wallHugContactPoint, lookSensitivity);
|
||||
}
|
||||
@@ -1414,7 +1291,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
Bobbing.CameraBobbingParams cameraBobbingParams = new Bobbing.CameraBobbingParams
|
||||
{
|
||||
Delta = delta,
|
||||
IsOnFloorCustom = isOnFloorCustom() || _onWallRunning.Active || _onWallRunningCoyoteEnabled.Active,
|
||||
IsOnFloorCustom = isOnFloorCustom() || _onWallRunning.Active,
|
||||
Velocity = Velocity,
|
||||
SettingsMultiplier = _headBobbingMultiplier
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user