Compare commits
4 Commits
release/me
...
v0.2.25
| Author | SHA1 | Date | |
|---|---|---|---|
| 81ce45a0dc | |||
| 1caf202310 | |||
| 22c4301244 | |||
| 032e059826 |
@@ -13,22 +13,27 @@ public partial class CueHandlerInspectorPlugin : EditorInspectorPlugin
|
|||||||
public override bool _CanHandle(GodotObject @object)
|
public override bool _CanHandle(GodotObject @object)
|
||||||
{
|
{
|
||||||
// Find out if its an implementation of CueHandler without having to add [Tool] attribute to them.
|
// Find out if its an implementation of CueHandler without having to add [Tool] attribute to them.
|
||||||
if (@object?.GetScript().As<CSharpScript>() is CSharpScript script)
|
try
|
||||||
{
|
{
|
||||||
StringName className = script.GetGlobalName();
|
if (@object.GetScript().As<CSharpScript>() is not { }) return false;
|
||||||
|
}
|
||||||
Type baseType = typeof(ForgeCueHandler);
|
catch (Exception e)
|
||||||
System.Reflection.Assembly assembly = baseType.Assembly;
|
{
|
||||||
|
return false;
|
||||||
Type? implementationType =
|
|
||||||
Array.Find(assembly.GetTypes(), x =>
|
|
||||||
x.Name == className &&
|
|
||||||
baseType.IsAssignableFrom(x));
|
|
||||||
|
|
||||||
return implementationType is not null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
var script = @object.GetScript().As<CSharpScript>();
|
||||||
|
StringName className = script.GetGlobalName();
|
||||||
|
|
||||||
|
Type baseType = typeof(ForgeCueHandler);
|
||||||
|
System.Reflection.Assembly assembly = baseType.Assembly;
|
||||||
|
|
||||||
|
Type? implementationType =
|
||||||
|
Array.Find(assembly.GetTypes(), x =>
|
||||||
|
x.Name == className &&
|
||||||
|
baseType.IsAssignableFrom(x));
|
||||||
|
|
||||||
|
return implementationType is not null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool _ParseProperty(
|
public override bool _ParseProperty(
|
||||||
|
|||||||
@@ -24,9 +24,6 @@ use_collision = true
|
|||||||
size = Vector3(1, 17.5, 9.5)
|
size = Vector3(1, 17.5, 9.5)
|
||||||
material = ExtResource("3_1qo78")
|
material = ExtResource("3_1qo78")
|
||||||
|
|
||||||
[node name="Player" parent="." index="7" unique_id=1309399929]
|
|
||||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
|
||||||
|
|
||||||
[node name="GroundedSpawner" parent="." index="8" unique_id=580981173 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
[node name="GroundedSpawner" parent="." index="8" unique_id=580981173 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.5, 1, -42.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 6.5, 1, -42.5)
|
||||||
EnemyToSpawn = ExtResource("5_iq67o")
|
EnemyToSpawn = ExtResource("5_iq67o")
|
||||||
@@ -35,6 +32,7 @@ HealthInputs = ExtResource("7_ucbss")
|
|||||||
DamageInputs = ExtResource("8_2brdd")
|
DamageInputs = ExtResource("8_2brdd")
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
SpawnInterval = 5.0
|
SpawnInterval = 5.0
|
||||||
|
IsActiveOnStart = false
|
||||||
|
|
||||||
[node name="GroundedSpawner2" parent="." index="9" unique_id=1026317919 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
[node name="GroundedSpawner2" parent="." index="9" unique_id=1026317919 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 46.5, 11.5, -34.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 46.5, 11.5, -34.5)
|
||||||
@@ -44,6 +42,7 @@ HealthInputs = ExtResource("7_ucbss")
|
|||||||
DamageInputs = ExtResource("8_2brdd")
|
DamageInputs = ExtResource("8_2brdd")
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
SpawnInterval = 5.0
|
SpawnInterval = 5.0
|
||||||
|
IsActiveOnStart = false
|
||||||
|
|
||||||
[node name="GroundedSpawner3" parent="." index="10" unique_id=241829575 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
[node name="GroundedSpawner3" parent="." index="10" unique_id=241829575 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 44.5, 0, -3)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 44.5, 0, -3)
|
||||||
@@ -53,6 +52,7 @@ HealthInputs = ExtResource("7_ucbss")
|
|||||||
DamageInputs = ExtResource("8_2brdd")
|
DamageInputs = ExtResource("8_2brdd")
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
SpawnInterval = 5.0
|
SpawnInterval = 5.0
|
||||||
|
IsActiveOnStart = false
|
||||||
|
|
||||||
[node name="FlyingSpawner" parent="." index="11" unique_id=962840208 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
[node name="FlyingSpawner" parent="." index="11" unique_id=962840208 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 16.5, 19, -19.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 16.5, 19, -19.5)
|
||||||
@@ -62,6 +62,7 @@ HealthInputs = ExtResource("11_5jlg7")
|
|||||||
DamageInputs = ExtResource("12_pjgox")
|
DamageInputs = ExtResource("12_pjgox")
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
SpawnInterval = 5.0
|
SpawnInterval = 5.0
|
||||||
|
IsActiveOnStart = false
|
||||||
|
|
||||||
[node name="FlyingSpawner2" parent="." index="12" unique_id=365997644 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
[node name="FlyingSpawner2" parent="." index="12" unique_id=365997644 node_paths=PackedStringArray("Target") instance=ExtResource("4_jaqjx")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45.5, 25.5, -42.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 45.5, 25.5, -42.5)
|
||||||
@@ -71,6 +72,7 @@ HealthInputs = ExtResource("11_5jlg7")
|
|||||||
DamageInputs = ExtResource("12_pjgox")
|
DamageInputs = ExtResource("12_pjgox")
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
SpawnInterval = 5.0
|
SpawnInterval = 5.0
|
||||||
|
IsActiveOnStart = false
|
||||||
|
|
||||||
[node name="Targets" type="Node3D" parent="." index="13" unique_id=1620747784]
|
[node name="Targets" type="Node3D" parent="." index="13" unique_id=1620747784]
|
||||||
|
|
||||||
@@ -103,3 +105,6 @@ transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 27, 13.5, -9)
|
|||||||
|
|
||||||
[node name="FixedDashthroughTarget3" parent="Targets" index="9" unique_id=1106453232 instance=ExtResource("13_iq67o")]
|
[node name="FixedDashthroughTarget3" parent="Targets" index="9" unique_id=1106453232 instance=ExtResource("13_iq67o")]
|
||||||
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 43, 6, -8.5)
|
transform = Transform3D(0.5, 0, 0, 0, 0.5, 0, 0, 0, 0.5, 43, 6, -8.5)
|
||||||
|
|
||||||
|
[node name="Player" parent="." index="14" unique_id=1309399929]
|
||||||
|
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 3, 0, 0)
|
||||||
|
|||||||
@@ -61,16 +61,13 @@ size = Vector3(5, 2.25, 3.75)
|
|||||||
size = Vector3(5.5, 4.5, 2)
|
size = Vector3(5.5, 4.5, 2)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_prjj8"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_prjj8"]
|
||||||
size = Vector3(2, 3.25, 1.25)
|
size = Vector3(2, 3.25, 5.25)
|
||||||
|
|
||||||
[sub_resource type="BoxShape3D" id="BoxShape3D_1opdv"]
|
[sub_resource type="BoxShape3D" id="BoxShape3D_1opdv"]
|
||||||
size = Vector3(8.25, 3.25, 2.75)
|
size = Vector3(8.25, 3.25, 2.75)
|
||||||
|
|
||||||
[node name="Main" unique_id=955321579 instance=ExtResource("1_8n6bu")]
|
[node name="Main" unique_id=955321579 instance=ExtResource("1_8n6bu")]
|
||||||
|
|
||||||
[node name="Player" parent="." index="6" unique_id=1309399929]
|
|
||||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, -0.5, 0, 0)
|
|
||||||
|
|
||||||
[node name="Playground" type="Node3D" parent="." index="7" unique_id=2099606598]
|
[node name="Playground" type="Node3D" parent="." index="7" unique_id=2099606598]
|
||||||
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -8.25, 13, 58.5)
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, -8.25, 13, 58.5)
|
||||||
|
|
||||||
@@ -429,7 +426,7 @@ second_input_texture = ExtResource("13_nwk5u")
|
|||||||
tuto_text = "throw weapon"
|
tuto_text = "throw weapon"
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Tutorial/Triggers/TutoTrigger7" index="1" unique_id=1932556219]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Tutorial/Triggers/TutoTrigger7" index="1" unique_id=1932556219]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.875, 3.75)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.875, 4)
|
||||||
shape = SubResource("BoxShape3D_prjj8")
|
shape = SubResource("BoxShape3D_prjj8")
|
||||||
|
|
||||||
[node name="TutoTrigger8" parent="Tutorial/Triggers" index="7" unique_id=36196488 instance=ExtResource("10_dkfm7")]
|
[node name="TutoTrigger8" parent="Tutorial/Triggers" index="7" unique_id=36196488 instance=ExtResource("10_dkfm7")]
|
||||||
@@ -620,9 +617,9 @@ size = Vector3(5, 1, 11)
|
|||||||
material = ExtResource("3_wsc2c")
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
[node name="CSGBox3D141" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="29" unique_id=1207463075]
|
[node name="CSGBox3D141" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="29" unique_id=1207463075]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 21.487345, 68.625)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 4, 21.487345, 70.125)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
size = Vector3(5, 1, 3.25)
|
size = Vector3(5, 1, 6.25)
|
||||||
material = ExtResource("3_wsc2c")
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
[node name="CSGBox3D121" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="30" unique_id=302433684]
|
[node name="CSGBox3D121" type="CSGBox3D" parent="Tutorial/DashWithMantle" index="30" unique_id=302433684]
|
||||||
@@ -721,26 +718,38 @@ use_collision = true
|
|||||||
size = Vector3(9, 5.5, 2)
|
size = Vector3(9, 5.5, 2)
|
||||||
material = ExtResource("3_wsc2c")
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
[node name="CSGBox3D118" type="CSGBox3D" parent="Tutorial" index="20" unique_id=1950738925]
|
[node name="CSGBox3D123" type="CSGBox3D" parent="Tutorial" index="20" unique_id=765166179]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 0.625, 6)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(9, 2.25, 2)
|
||||||
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
|
[node name="CSGBox3D118" type="CSGBox3D" parent="Tutorial" index="21" unique_id=1950738925]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, -7.75, -10)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, -7.75, -10)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
size = Vector3(9, 2.5, 2)
|
size = Vector3(9, 2.5, 2)
|
||||||
material = ExtResource("3_wsc2c")
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
[node name="CSGBox3D120" type="CSGBox3D" parent="Tutorial" index="21" unique_id=1024529143]
|
[node name="CSGBox3D120" type="CSGBox3D" parent="Tutorial" index="22" unique_id=1024529143]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, -21.75, -11.75)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, -21.75, -11.75)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
size = Vector3(9, 25.5, 37.5)
|
size = Vector3(9, 25.5, 37.5)
|
||||||
material = ExtResource("3_wsc2c")
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
[node name="CSGBox3D122" type="CSGBox3D" parent="Tutorial" index="22" unique_id=1261455320]
|
[node name="CSGBox3D122" type="CSGBox3D" parent="Tutorial" index="23" unique_id=1261455320]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.5, 16.5, -28.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -15.5, 16.5, -28.5)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
size = Vector3(3, 1, 4)
|
size = Vector3(3, 1, 4)
|
||||||
material = ExtResource("3_wsc2c")
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
[node name="CSGBox3D143" type="CSGBox3D" parent="Tutorial" index="23" unique_id=1090375546]
|
[node name="CSGBox3D143" type="CSGBox3D" parent="Tutorial" index="24" unique_id=1090375546]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 27.625, 34)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -5, 27.625, 34)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
size = Vector3(2, 3.25, 1)
|
size = Vector3(2, 3.25, 1)
|
||||||
material = ExtResource("3_wsc2c")
|
material = ExtResource("3_wsc2c")
|
||||||
|
|
||||||
|
[node name="Player" parent="." index="9" unique_id=1309399929]
|
||||||
|
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, -0.5, 0, 0)
|
||||||
|
|
||||||
|
[node name="PlayerFellRespawn" parent="." index="10" unique_id=479136076]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.5, 1.5, 0)
|
||||||
|
|||||||
@@ -160,7 +160,7 @@ WallHugHorizontalDeceleration = 1.0
|
|||||||
WallRunUpwardVelocityFactor = 0.5
|
WallRunUpwardVelocityFactor = 0.5
|
||||||
MinimumWallRunUpwardSpeed = 4.0
|
MinimumWallRunUpwardSpeed = 4.0
|
||||||
WallRunAltitudeLossSpeed = 8.0
|
WallRunAltitudeLossSpeed = 8.0
|
||||||
WallRunSpeedThreshold = 2.0
|
WallRunSpeedThreshold = 1.0
|
||||||
|
|
||||||
[node name="CHealth" parent="." unique_id=1244478698 instance=ExtResource("3_q7bng")]
|
[node name="CHealth" parent="." unique_id=1244478698 instance=ExtResource("3_q7bng")]
|
||||||
RHealth = ExtResource("4_m8gvy")
|
RHealth = ExtResource("4_m8gvy")
|
||||||
@@ -1120,7 +1120,7 @@ delay_in_seconds = "0.0"
|
|||||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall" unique_id=342055859]
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/OnWall" unique_id=342055859]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../Jump/SimpleJump")
|
to = NodePath("../../Jump/SimpleJump")
|
||||||
event = &"jump"
|
event = &"wall_jump"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnDash" type="Node" parent="StateChart/Root/Movement/OnWall" unique_id=43147957]
|
[node name="OnDash" type="Node" parent="StateChart/Root/Movement/OnWall" unique_id=43147957]
|
||||||
|
|||||||
@@ -245,7 +245,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
public float MinimumWallRunHorizontalSpeed { get; set; } = 12f;
|
public float MinimumWallRunHorizontalSpeed { get; set; } = 12f;
|
||||||
[Export(PropertyHint.Range, "1,20,0.1,or_greater")]
|
[Export(PropertyHint.Range, "1,20,0.1,or_greater")]
|
||||||
public float WallRunAltitudeLossSpeed { get; set; } = 10f;
|
public float WallRunAltitudeLossSpeed { get; set; } = 10f;
|
||||||
[Export(PropertyHint.Range, "1,20,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
||||||
public float WallRunSpeedThreshold { get; set; } = 8f;
|
public float WallRunSpeedThreshold { get; set; } = 8f;
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -869,16 +869,16 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
_playerState.SendEvent("grounded");
|
_playerState.SendEvent("grounded");
|
||||||
|
|
||||||
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
||||||
|
|
||||||
if (!WallHugSystem.IsWallHugging())
|
if (!WallHugSystem.IsWallHugging())
|
||||||
{
|
{
|
||||||
_isWallJumpAvailable = true; // reset wall jump if we left the wall
|
_isWallJumpAvailable = true; // reset wall jump if we left the wall
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Going upwards, we stay simply airborne
|
// // Going upwards, we stay simply airborne
|
||||||
if (Velocity.AngleTo(Vector3.Up) < Math.PI / 4)
|
// if (Velocity.AngleTo(Vector3.Up) < Math.PI / 4)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
// Should we start a wall run
|
// Should we start a wall run
|
||||||
if (ShouldStartWallRun())
|
if (ShouldStartWallRun())
|
||||||
@@ -1188,15 +1188,19 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
}
|
}
|
||||||
public void OnWallDetected()
|
public void OnWallDetected()
|
||||||
{
|
{
|
||||||
if (!_onWall.Active)
|
// if (!_onWall.Active)
|
||||||
return;
|
// return;
|
||||||
|
|
||||||
var newWallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Up);
|
var newWallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Up);
|
||||||
if (newWallNormal.AngleTo(_wallHugStartNormal) > Mathf.Pi/4) return;
|
// if (newWallNormal.AngleTo(_wallHugStartNormal) > Mathf.Pi/4) return;
|
||||||
_wallHugStartNormal = newWallNormal;
|
_wallHugStartNormal = newWallNormal;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
private float _timeOnWall;
|
||||||
public void OnWallStarted()
|
public void OnWallStarted()
|
||||||
{
|
{
|
||||||
|
_timeOnWall = 0f;
|
||||||
if (_simpleDashCooldownTimer.IsStopped())
|
if (_simpleDashCooldownTimer.IsStopped())
|
||||||
_canDash = true;
|
_canDash = true;
|
||||||
else
|
else
|
||||||
@@ -1212,6 +1216,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
}
|
}
|
||||||
public void OnWallStopped()
|
public void OnWallStopped()
|
||||||
{
|
{
|
||||||
|
_timeOnWall = 0f;
|
||||||
}
|
}
|
||||||
public void OnLeaveWallFromRun()
|
public void OnLeaveWallFromRun()
|
||||||
{
|
{
|
||||||
@@ -1221,16 +1226,20 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
{
|
{
|
||||||
// _canDash = true;
|
// _canDash = true;
|
||||||
// _canDashAirborne = true;
|
// _canDashAirborne = true;
|
||||||
|
_timeOnWall += delta;
|
||||||
|
|
||||||
WallHug(delta);
|
if (IsInputTowardsWall(_wallHugStartNormal))
|
||||||
if (ShouldStartWallRun())
|
WallHug(delta);
|
||||||
{
|
else
|
||||||
_playerState.SendEvent("wall_run");
|
MoveInAir(delta, IsGroundLike());
|
||||||
return;
|
// if (ShouldStartWallRun())
|
||||||
}
|
// {
|
||||||
|
// _playerState.SendEvent("wall_run");
|
||||||
|
// return;
|
||||||
|
// }
|
||||||
if (isOnFloorCustom())
|
if (isOnFloorCustom())
|
||||||
_playerState.SendEvent("grounded");
|
_playerState.SendEvent("grounded");
|
||||||
if (!WallHugSystem.IsWallHugging() || !IsInputTowardsWall(_wallHugStartNormal))
|
if (!WallHugSystem.IsWallHugging())
|
||||||
_playerState.SendEvent("start_falling");
|
_playerState.SendEvent("start_falling");
|
||||||
}
|
}
|
||||||
public void HandleWallHanging(float delta)
|
public void HandleWallHanging(float delta)
|
||||||
@@ -1252,6 +1261,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
{
|
{
|
||||||
// _canDash = false;
|
// _canDash = false;
|
||||||
// _canDashAirborne = false;
|
// _canDashAirborne = false;
|
||||||
|
_timeOnWall += delta;
|
||||||
|
|
||||||
// Find horizontal velocity projected on the current wall
|
// Find horizontal velocity projected on the current wall
|
||||||
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
||||||
@@ -1263,7 +1273,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
// Adapt vertical speed
|
// Adapt vertical speed
|
||||||
var verticalSpeed = Velocity.Y - WallRunAltitudeLossSpeed * delta;
|
var verticalSpeed = Velocity.Y - WallRunAltitudeLossSpeed * delta;
|
||||||
Velocity = finalHVel + Vector3.Up*verticalSpeed;
|
Velocity = finalHVel + Vector3.Up*verticalSpeed;
|
||||||
// Velocity *= 0.999f;
|
Velocity *= 0.999f;
|
||||||
|
|
||||||
_currentWallContactPoint = WallHugSystem.WallHugLocation.UnwrapOr(Vector3.Zero);
|
_currentWallContactPoint = WallHugSystem.WallHugLocation.UnwrapOr(Vector3.Zero);
|
||||||
|
|
||||||
@@ -1273,7 +1283,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
_playerState.SendEvent("grounded");
|
_playerState.SendEvent("grounded");
|
||||||
if (!WallHugSystem.IsWallHugging())
|
if (!WallHugSystem.IsWallHugging())
|
||||||
_playerState.SendEvent("start_falling");
|
_playerState.SendEvent("start_falling");
|
||||||
if (Velocity.Length() < WallRunSpeedThreshold / 2f)
|
if (!CanKeepWallRun())
|
||||||
_playerState.SendEvent("wall_hug");
|
_playerState.SendEvent("wall_hug");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1286,27 +1296,89 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
|
|
||||||
public bool ShouldStartWallRun()
|
public bool ShouldStartWallRun()
|
||||||
{
|
{
|
||||||
var wallNormal = WallHugSystem.WallHugNormal.UnwrapOr(Vector3.Zero);
|
GD.Print(_wallHugStartNormal);
|
||||||
var isIndeedWall = wallNormal.Y < 0.1;
|
if (_wallHugStartNormal.Length() < Mathf.Epsilon)
|
||||||
var isThereInput = GetMoveInput().Length() > Mathf.Epsilon;
|
{
|
||||||
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
// GD.Print("No wall normal");
|
||||||
var hvelProjected = Velocity.Slide(_wallHugStartNormal);
|
return false;
|
||||||
var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold;
|
}
|
||||||
var isCoplanarEnough = Math.Abs(Velocity.Dot(wallNormal)) < 0.3;
|
|
||||||
var isGoingDownwards = Velocity.Dot(Vector3.Down) > 0.9;
|
|
||||||
var isLookingInDirectionOfRun = true; // hvelProjected.Dot(-HeadSystem.GetForwardHorizontalVector()) > 0.5;
|
|
||||||
var shouldStart = haveEnoughSpeed && isThereInput && !isGoingDownwards && isIndeedWall && isCoplanarEnough && isLookingInDirectionOfRun;
|
|
||||||
|
|
||||||
var debugText = "--------------\n";
|
|
||||||
debugText += shouldStart ? "WALL RUN STARTED\n" : "NO WALL RUN\n";
|
|
||||||
debugText += $"Enough speed? {haveEnoughSpeed}\n";
|
|
||||||
debugText += $"Coplanar enough? {isCoplanarEnough}\n";
|
|
||||||
debugText += $"Going downwards? {isGoingDownwards}\n";
|
|
||||||
debugText += $"Is looking in direction of run? {isLookingInDirectionOfRun}\n";
|
|
||||||
debugText += "--------------\n";
|
|
||||||
GD.Print(debugText);
|
|
||||||
|
|
||||||
return shouldStart;
|
var isIndeedWall = _wallHugStartNormal.Y < 0.1;
|
||||||
|
if (!isIndeedWall)
|
||||||
|
{
|
||||||
|
// GD.Print("Not a wall");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isThereInput = GetMoveInput().Length() > Mathf.Epsilon;
|
||||||
|
if (!isThereInput)
|
||||||
|
{
|
||||||
|
// GD.Print("No input");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!IsInputForwardOrTowardsWall())
|
||||||
|
{
|
||||||
|
// GD.Print("Input isn't forward or towards wall");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var canUseVelocity = Velocity.Length() > WallRunSpeedThreshold;
|
||||||
|
if (!canUseVelocity)
|
||||||
|
{
|
||||||
|
// GD.Print("Not enough speed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var hvel = new Vector3(Velocity.X, 0, Velocity.Z);
|
||||||
|
var hvelProjected = hvel.Slide(_wallHugStartNormal);
|
||||||
|
var haveEnoughSpeed = hvelProjected.Length() > WallRunSpeedThreshold;
|
||||||
|
if (!haveEnoughSpeed)
|
||||||
|
{
|
||||||
|
// GD.Print("Not enough projected speed");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isCoplanarEnough = Math.Abs(Velocity.Normalized().Dot(_wallHugStartNormal)) < 0.9;
|
||||||
|
if (!isCoplanarEnough)
|
||||||
|
{
|
||||||
|
// GD.Print("Not coplanar enough");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isGoingDownwards = Velocity.Normalized().Dot(Vector3.Down) > 0.7;
|
||||||
|
if (isGoingDownwards)
|
||||||
|
{
|
||||||
|
// GD.Print("Going down");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
var isLookingInDirectionOfRun = hvelProjected.Normalized().Dot(-HeadSystem.GetForwardHorizontalVector()) > 0.5;
|
||||||
|
if (!isLookingInDirectionOfRun)
|
||||||
|
{
|
||||||
|
// GD.Print("Not looking in direction of run");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsInputForwardOrTowardsWall()
|
||||||
|
{
|
||||||
|
return GetInputLocalHDirection().Z < -0.2f || IsInputTowardsWall(_wallHugStartNormal);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanKeepWallRun()
|
||||||
|
{
|
||||||
|
var isThereInput = GetMoveInput().Length() > Mathf.Epsilon;
|
||||||
|
if (!isThereInput) return false;
|
||||||
|
|
||||||
|
if (!IsInputForwardOrTowardsWall()) return false;
|
||||||
|
|
||||||
|
var haveEnoughSpeed = Velocity.Length() > WallRunSpeedThreshold;
|
||||||
|
if (!haveEnoughSpeed) return false;
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void WallHug(float delta)
|
public void WallHug(float delta)
|
||||||
@@ -1319,6 +1391,7 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
}
|
}
|
||||||
public void WallHang(float delta)
|
public void WallHang(float delta)
|
||||||
{
|
{
|
||||||
|
_timeOnWall += 1; // Consider we've already spent quite some time on wall
|
||||||
Velocity = Vector3.Zero;
|
Velocity = Vector3.Zero;
|
||||||
GlobalPosition = _wallHugStartLocation;
|
GlobalPosition = _wallHugStartLocation;
|
||||||
}
|
}
|
||||||
@@ -1365,11 +1438,20 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
_playerState.SendEvent("mantle");
|
_playerState.SendEvent("mantle");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (WallHugSystem.IsWallHugging())
|
if (_onWallRunning.Active || _onWallHanging.Active) // Always allow jumping out of wall run and hang
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("wall_jump");
|
_playerState.SendEvent("wall_jump");
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
if (_onWallHugging.Active && _isWallJumpAvailable) // Limit number of jumps doable when hugging
|
||||||
|
{
|
||||||
|
_playerState.SendEvent("wall_jump");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Regular jump
|
||||||
_playerState.SendEvent("jump");
|
_playerState.SendEvent("jump");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1465,13 +1547,22 @@ public partial class PlayerController : CharacterBody3D,
|
|||||||
|
|
||||||
SetHorizontalVelocity(currentHorizontalVelocity + wallJumpHorizontalVelocity);
|
SetHorizontalVelocity(currentHorizontalVelocity + wallJumpHorizontalVelocity);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsOnWallForLongEnough()
|
||||||
|
{
|
||||||
|
return _timeOnWall >= 0.1f;
|
||||||
|
}
|
||||||
|
|
||||||
public void OnJumpFromWall()
|
public void OnJumpFromWall()
|
||||||
{
|
{
|
||||||
if (!IsFacingWall() || (!_isWallJumpAvailable && IsFacingWall()))
|
// if (!IsFacingWall() || (!_isWallJumpAvailable && IsFacingWall()))
|
||||||
{
|
// {
|
||||||
|
// ComputeJumpFromWallHSpeed(WallJumpStartVelocity);
|
||||||
|
// }
|
||||||
|
if (IsOnWallForLongEnough() || _onWallRunning.Active)
|
||||||
ComputeJumpFromWallHSpeed(WallJumpStartVelocity);
|
ComputeJumpFromWallHSpeed(WallJumpStartVelocity);
|
||||||
}
|
|
||||||
|
|
||||||
|
// OnJumpStarted(DoubleJumpStartVelocity);
|
||||||
// Remove the ability to dash straight away so you cannot scale up the wall
|
// Remove the ability to dash straight away so you cannot scale up the wall
|
||||||
// _canDashAirborne = false;
|
// _canDashAirborne = false;
|
||||||
_airborneDashCooldownTimer.Start();
|
_airborneDashCooldownTimer.Start();
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
extends Area3D
|
extends Area3D
|
||||||
|
class_name TutoTrigger
|
||||||
|
|
||||||
@onready var control: Control = $Control
|
@onready var control: Control = $Control
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user