base movement tutorial done
This commit is contained in:
@@ -76,6 +76,8 @@ public partial class PlayerController : CharacterBody3D,
|
||||
// Inspector stuff
|
||||
[Export] public Marker3D TutorialWeaponTarget;
|
||||
[Export] public bool TutorialDone { get; set; }
|
||||
[Export] public bool HasSword { get; set; } = true;
|
||||
[Export] public bool HasParry { get; set; } = true;
|
||||
|
||||
// Combat stuff
|
||||
[ExportCategory("Combat")]
|
||||
@@ -523,8 +525,10 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
EmpoweredActionsLeft = MaxNumberOfEmpoweredActions;
|
||||
|
||||
if (!TutorialDone)
|
||||
PlaceWeaponForTutorial();
|
||||
// if (!TutorialDone)
|
||||
// PlaceWeaponForTutorial();
|
||||
|
||||
HeadSystem.SetWeaponsVisible(HasSword, HasParry);
|
||||
|
||||
///////////////////////////
|
||||
// Signal setup ///////////
|
||||
@@ -826,14 +830,7 @@ public partial class PlayerController : CharacterBody3D,
|
||||
return;
|
||||
|
||||
// Should we start a wall run
|
||||
var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero);
|
||||
var isIndeedWall = wallNormal.Y < 0.1;
|
||||
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
||||
var hvelProjected = hvel.Slide(_wallHugStartNormal);
|
||||
var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold;
|
||||
var isCoplanarEnough = Velocity.AngleTo(wallNormal) > Math.PI/4 && Velocity.AngleTo(wallNormal) < 3*Math.PI/4;
|
||||
var isGoingDownwards = Velocity.AngleTo(Vector3.Down) < Math.PI/4;
|
||||
if (haveEnoughSpeed && isCoplanarEnough && !isGoingDownwards && isIndeedWall && !_coyoteEnabled.Active)
|
||||
if (ShouldStartWallRun())
|
||||
{
|
||||
SetVerticalVelocity(WallRunUpwardVelocity);
|
||||
_playerState.SendEvent("wall_run");
|
||||
@@ -841,12 +838,25 @@ public partial class PlayerController : CharacterBody3D,
|
||||
}
|
||||
|
||||
// If all else fail and we go down, we hug
|
||||
var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero);
|
||||
if (Velocity.Y < 0 && IsInputTowardsWall(wallNormal))
|
||||
{
|
||||
_playerState.SendEvent("wall_hug");
|
||||
}
|
||||
}
|
||||
|
||||
public bool ShouldStartWallRun()
|
||||
{
|
||||
var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero);
|
||||
var isIndeedWall = wallNormal.Y < 0.1;
|
||||
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
||||
var hvelProjected = hvel.Slide(_wallHugStartNormal);
|
||||
var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold;
|
||||
var isCoplanarEnough = Velocity.AngleTo(wallNormal) > Math.PI/4 && Velocity.AngleTo(wallNormal) < 3*Math.PI/4;
|
||||
var isGoingDownwards = Velocity.AngleTo(Vector3.Down) < Math.PI/4;
|
||||
return haveEnoughSpeed && isCoplanarEnough && !isGoingDownwards && isIndeedWall && !_coyoteEnabled.Active;
|
||||
}
|
||||
|
||||
public float ComputeVerticalSpeedGravity(float delta)
|
||||
{
|
||||
return Velocity.Y - CalculateGravityForce() * delta;
|
||||
@@ -1135,6 +1145,12 @@ public partial class PlayerController : CharacterBody3D,
|
||||
_canDashAirborne = true;
|
||||
|
||||
WallHug(delta);
|
||||
if (ShouldStartWallRun())
|
||||
{
|
||||
SetVerticalVelocity(WallRunUpwardVelocity);
|
||||
_playerState.SendEvent("wall_run");
|
||||
return;
|
||||
}
|
||||
if (isOnFloorCustom())
|
||||
_playerState.SendEvent("grounded");
|
||||
if (!WallHugSystem.IsWallHugging() || !IsInputTowardsWall(_wallHugStartNormal))
|
||||
@@ -1268,6 +1284,13 @@ public partial class PlayerController : CharacterBody3D,
|
||||
{
|
||||
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
||||
|
||||
// if (ShouldStartWallRun())
|
||||
// {
|
||||
// SetVerticalVelocity(WallRunUpwardVelocity);
|
||||
// _playerState.SendEvent("wall_run");
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Update horizontal velocity
|
||||
var horizontalVelocity = ComputeHVelocityAir(delta);
|
||||
Velocity = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z);
|
||||
@@ -1667,10 +1690,12 @@ public partial class PlayerController : CharacterBody3D,
|
||||
///////////////////////////
|
||||
public void OnInputAimPressed()
|
||||
{
|
||||
if (!HasSword) return;
|
||||
_playerState.SendEvent("aim_pressed");
|
||||
}
|
||||
public void OnInputAimDown()
|
||||
{
|
||||
if (!HasSword) return;
|
||||
_playerState.SendEvent("aim_down");
|
||||
}
|
||||
public void OnInputAimReleased()
|
||||
@@ -1722,6 +1747,8 @@ public partial class PlayerController : CharacterBody3D,
|
||||
///////////////////////////
|
||||
public void OnInputParryPressed()
|
||||
{
|
||||
if (!HasParry) return;
|
||||
|
||||
var attackToDo = _isEnemyInDashAttackRange ? "dash_parry" : "standard_parry";
|
||||
_playerState.SendEvent(attackToDo);
|
||||
}
|
||||
@@ -2115,6 +2142,8 @@ public partial class PlayerController : CharacterBody3D,
|
||||
|
||||
public void OnInputHitPressed()
|
||||
{
|
||||
if (!HasSword) return;
|
||||
|
||||
if (_onWallHanging.Active) return;
|
||||
|
||||
if (_aiming.Active && WeaponSystem.InHandState.Active)
|
||||
|
||||
Reference in New Issue
Block a user