lots of tutorial fixed
This commit is contained in:
@@ -73,7 +73,7 @@ DoubleJumpGravityLesseningFactor = 1.5
|
||||
MegaJumpStartVelocity = 30.0
|
||||
MegaJumpHangTimeInFrames = 12
|
||||
MegaJumpGravityLesseningFactor = 1.2
|
||||
WallJumpStartVelocity = 8.0
|
||||
WallJumpStartVelocity = 12.0
|
||||
MaxNumberOfEmpoweredActions = 3
|
||||
SimpleDashStrength = 15.0
|
||||
PoweredDashStrength = 30.0
|
||||
@@ -194,6 +194,7 @@ ThrowForce = 15.0
|
||||
StraightThrowDuration = 0.05
|
||||
|
||||
[node name="DashIndicator" type="Node3D" parent="."]
|
||||
visible = false
|
||||
|
||||
[node name="DashIndicatorMesh" type="MeshInstance3D" parent="DashIndicator"]
|
||||
transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 0, -1)
|
||||
@@ -241,7 +242,7 @@ size_flags_vertical = 0
|
||||
|
||||
[node name="DashesLabel" type="Label" parent="UI/MarginContainer/VBoxContainer"]
|
||||
layout_mode = 2
|
||||
text = "Dashes"
|
||||
text = "Empowered actions"
|
||||
|
||||
[node name="HBoxContainer" type="HBoxContainer" parent="UI/MarginContainer/VBoxContainer"]
|
||||
custom_minimum_size = Vector2(0, 30)
|
||||
@@ -626,6 +627,12 @@ delay_in_seconds = "0.0"
|
||||
script = ExtResource("26_infe6")
|
||||
initial_state = NodePath("Hugging")
|
||||
|
||||
[node name="OnDash" type="Node" parent="StateChart/Root/Movement/OnWall"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Dashing/Dash")
|
||||
event = &"dash"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="OnGrounded" type="Node" parent="StateChart/Root/Movement/OnWall"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../Grounded")
|
||||
@@ -671,7 +678,7 @@ delay_in_seconds = "0.0"
|
||||
[node name="OnDrop" type="Node" parent="StateChart/Root/Movement/OnWall/Hugging"]
|
||||
script = ExtResource("28_n7qhm")
|
||||
to = NodePath("../../HugCanceled")
|
||||
event = &"dash"
|
||||
event = &"__unused_dash"
|
||||
delay_in_seconds = "0.0"
|
||||
|
||||
[node name="Hanging" type="Node" parent="StateChart/Root/Movement/OnWall"]
|
||||
|
||||
@@ -8,6 +8,13 @@ using RustyOptions;
|
||||
|
||||
public partial class PlayerController : CharacterBody3D
|
||||
{
|
||||
public enum AllowedInputs
|
||||
{
|
||||
All,
|
||||
MoveCamera,
|
||||
None,
|
||||
}
|
||||
|
||||
// User API to important child nodes.
|
||||
public HeadSystem HeadSystem;
|
||||
public Bobbing Bobbing;
|
||||
@@ -44,7 +51,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
private float _inputRotateY;
|
||||
private float _inputRotateFloorplane;
|
||||
|
||||
private int _framesSinceJumpAtApex = 0;
|
||||
private int _framesSinceJumpAtApex;
|
||||
|
||||
// Timers
|
||||
private Timer _timeScaleAimInAirTimer;
|
||||
@@ -158,12 +165,14 @@ public partial class PlayerController : CharacterBody3D
|
||||
PlayerUi.SetNumberOfDashesLeft(value);
|
||||
}
|
||||
}
|
||||
public bool TutorialDone { get; set; } = false;
|
||||
public bool TutorialDone { get; set; }
|
||||
|
||||
public AllowedInputs CurrentlyAllowedInputs { get; set; } = AllowedInputs.All;
|
||||
|
||||
private bool _canDashAirborne = true;
|
||||
private bool _isWallJumpAvailable = true;
|
||||
private bool _canDash = true;
|
||||
private bool _shouldMantleOnDashEnded = false;
|
||||
private bool _shouldMantleOnDashEnded;
|
||||
|
||||
private StateChart _playerState;
|
||||
|
||||
@@ -198,20 +207,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
public override void _Ready()
|
||||
{
|
||||
var config = new ConfigFile();
|
||||
LoadSettings();
|
||||
|
||||
// Load data from a file.
|
||||
Error err = config.Load("user://config.cfg");
|
||||
|
||||
// If the file didn't load, ignore it.
|
||||
if (err != Error.Ok)
|
||||
{
|
||||
throw new Exception("Couldn't load config.cfg");
|
||||
}
|
||||
|
||||
_lookSensitivityMultiplier = (float) config.GetValue("InputSettings", "LookSensitivity", 1.0f);
|
||||
_headBobbingMultiplier = (float) config.GetValue("InputSettings", "HeadBobbingWhileWalking", 1.0f);
|
||||
_fovChangeMultiplier = (float) config.GetValue("InputSettings", "FovChangeWithSpeed", 1.0f);
|
||||
///////////////////////////
|
||||
// Getting components /////
|
||||
///////////////////////////
|
||||
@@ -385,10 +382,40 @@ public partial class PlayerController : CharacterBody3D
|
||||
_onMegajumpFromWall.Taken += OnMegajumpFromWall;
|
||||
}
|
||||
|
||||
public void SetAllowedInputsAll()
|
||||
{
|
||||
CurrentlyAllowedInputs = AllowedInputs.All;
|
||||
}
|
||||
public void SetAllowedInputsMoveCamera()
|
||||
{
|
||||
CurrentlyAllowedInputs = AllowedInputs.MoveCamera;
|
||||
}
|
||||
public void SetAllowedInputsNone()
|
||||
{
|
||||
CurrentlyAllowedInputs = AllowedInputs.None;
|
||||
}
|
||||
|
||||
public void LoadSettings()
|
||||
{
|
||||
var config = new ConfigFile();
|
||||
|
||||
// Load data from a file.
|
||||
Error err = config.Load("user://config.cfg");
|
||||
|
||||
// If the file didn't load, ignore it.
|
||||
if (err != Error.Ok)
|
||||
{
|
||||
throw new Exception("Couldn't load config.cfg");
|
||||
}
|
||||
|
||||
_lookSensitivityMultiplier = (float) config.GetValue("InputSettings", "LookSensitivity", 1.0f);
|
||||
_headBobbingMultiplier = (float) config.GetValue("InputSettings", "HeadBobbingWhileWalking", 1.0f);
|
||||
_fovChangeMultiplier = (float) config.GetValue("InputSettings", "FovChangeWithSpeed", 1.0f);
|
||||
}
|
||||
|
||||
public void OnTutorialDone(Node3D _)
|
||||
{
|
||||
TutorialDone = true;
|
||||
GD.Print("tutorial done");
|
||||
}
|
||||
|
||||
public void OnWallDetected()
|
||||
@@ -476,6 +503,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
public void OnDoubleJumpStarted()
|
||||
{
|
||||
_canDash = true;
|
||||
OnJumpStarted(DoubleJumpStartVelocity);
|
||||
}
|
||||
public void OnMegaJumpStarted()
|
||||
@@ -508,7 +536,10 @@ public partial class PlayerController : CharacterBody3D
|
||||
var wallNormal = WallHugSystem.GetWallNormal().UnwrapOr(Vector3.Up);
|
||||
var jumpVector = wallNormal * jumpStrength;
|
||||
|
||||
SetHorizontalVelocity(new Vector2(jumpVector.X, jumpVector.Z));
|
||||
var currentHorizontalVelocity = new Vector2(Velocity.X, Velocity.Z);
|
||||
var wallJumpHorizontalVelocity = new Vector2(jumpVector.X, jumpVector.Z);
|
||||
|
||||
SetHorizontalVelocity(currentHorizontalVelocity + wallJumpHorizontalVelocity);;
|
||||
}
|
||||
public void OnJumpFromWall()
|
||||
{
|
||||
@@ -661,11 +692,11 @@ public partial class PlayerController : CharacterBody3D
|
||||
}
|
||||
public void OnInputEmpowerDown()
|
||||
{
|
||||
_playerState.SendEvent("empower_down");
|
||||
// _playerState.SendEvent("empower_down");
|
||||
}
|
||||
public void OnInputEmpowerReleased()
|
||||
{
|
||||
_playerState.SendEvent("empower_released");
|
||||
// _playerState.SendEvent("empower_released");
|
||||
}
|
||||
public void OnInputDashPressed()
|
||||
{
|
||||
@@ -747,11 +778,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
|
||||
public void DashToFlyingWeaponTweenEnded()
|
||||
{
|
||||
// Get the weapon back
|
||||
GetTree().GetRoot().RemoveChild(WeaponRoot);
|
||||
AddChild(WeaponRoot);
|
||||
WeaponRoot.SetGlobalPosition(GlobalPosition);
|
||||
WeaponSystem.ResetWeapon();
|
||||
RecoverWeapon();
|
||||
|
||||
var vel = _dashDirection * PostDashSpeed;
|
||||
SetVelocity(vel);
|
||||
@@ -774,6 +801,14 @@ public partial class PlayerController : CharacterBody3D
|
||||
var dashTween = CreatePositionTween(dashLocation, AimedDashTime);
|
||||
dashTween.Finished += DashToPlantedWeaponTweenEnded;
|
||||
}
|
||||
|
||||
public void RecoverWeapon()
|
||||
{
|
||||
GetTree().GetRoot().RemoveChild(WeaponRoot);
|
||||
AddChild(WeaponRoot);
|
||||
WeaponRoot.SetGlobalPosition(GlobalPosition);
|
||||
WeaponSystem.ResetWeapon();
|
||||
}
|
||||
|
||||
public void DashToPlantedWeaponTweenEnded()
|
||||
{
|
||||
@@ -782,12 +817,8 @@ public partial class PlayerController : CharacterBody3D
|
||||
var isPlantedUnderPlatform = WeaponSystem.IsPlantedUnderPlatform();
|
||||
var shouldDashToHanging = isPlantedOnWall || isPlantedUnderPlatform;
|
||||
|
||||
// Get the weapon back
|
||||
GetTree().GetRoot().RemoveChild(WeaponRoot);
|
||||
AddChild(WeaponRoot);
|
||||
WeaponRoot.SetGlobalPosition(GlobalPosition);
|
||||
WeaponSystem.ResetWeapon();
|
||||
|
||||
RecoverWeapon();
|
||||
|
||||
var resultingEvent = shouldDashToHanging ? "to_planted" : "dash_finished";
|
||||
_playerState.SendEvent(resultingEvent);
|
||||
}
|
||||
@@ -976,7 +1007,7 @@ public partial class PlayerController : CharacterBody3D
|
||||
IsCapsuleHeightLessThanNormal = CapsuleCollider.IsCapsuleHeightLessThanNormal(),
|
||||
CurrentSpeedGreaterThanWalkSpeed = false,
|
||||
IsCrouchingHeight = CapsuleCollider.IsCrouchingHeight(),
|
||||
Delta = (float)delta,
|
||||
Delta = delta,
|
||||
FloorMaxAngle = FloorMaxAngle,
|
||||
GlobalPositionFromDriver = GlobalPosition,
|
||||
Velocity = Velocity,
|
||||
|
||||
Reference in New Issue
Block a user