Compare commits
27 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 98ed361546 | |||
| eb1c7f78fa | |||
| 35b9ea383c | |||
| 9690280cd7 | |||
| 65538495c4 | |||
| 561e026834 | |||
| 7c74b8b5e5 | |||
| f7705a6d57 | |||
| 0dcf4a3f99 | |||
| 4ccdbc0ee6 | |||
| 0436053c62 | |||
| 6b97c226f1 | |||
| b1e78df6c7 | |||
| 5908494977 | |||
| 63529a11ae | |||
| 255b87f991 | |||
| fd3eb35782 | |||
| 9e75193731 | |||
| 609078c584 | |||
| 893126ef78 | |||
| 6737668391 | |||
| ca77579168 | |||
| c6559d593a | |||
| e32dac9e6e | |||
| 30b4d1a2eb | |||
| 2fa4ce68e7 | |||
| 80e533d98e |
@@ -1,4 +1,5 @@
|
|||||||
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003AAction_00601_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FDecompilerCache_003Fdecompiler_003F7c0f83388bfc4d2c9d09befcec9dd79bc90908_003Fb8_003F4d300c4d_003FAction_00601_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANode_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fdf73a4db74df89d59655c5fb6326406f47fbfa9af1fa81518fe0a07c49d34133_003FNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ANode_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003Fdf73a4db74df89d59655c5fb6326406f47fbfa9af1fa81518fe0a07c49d34133_003FNode_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASceneTree_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F8d6960554e939a669841b1ece03d27df4ab42f92bb80be3767eaec8cdaccf84b_003FSceneTree_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
<s:String x:Key="/Default/CodeInspection/ExcludedFiles/FilesAndFoldersToSkip2/=7020124F_002D9FFC_002D4AC3_002D8F3D_002DAAB8E0240759_002Ff_003ASceneTree_002Ecs_002Fl_003AC_0021_003FUsers_003FMinimata_003FAppData_003FRoaming_003FJetBrains_003FRider2025_002E1_003Fresharper_002Dhost_003FSourcesCache_003F8d6960554e939a669841b1ece03d27df4ab42f92bb80be3767eaec8cdaccf84b_003FSceneTree_002Ecs/@EntryIndexedValue">ForceIncluded</s:String>
|
||||||
<s:Boolean x:Key="/Default/UserDictionary/Words/=floorplane/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
<s:Boolean x:Key="/Default/UserDictionary/Words/=floorplane/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -20,6 +20,8 @@ script = ExtResource("2_5i7wx")
|
|||||||
material_override = ExtResource("3_u2uhe")
|
material_override = ExtResource("3_u2uhe")
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="Cube_279" index="0"]
|
[node name="StaticBody3D" type="StaticBody3D" parent="Cube_279" index="0"]
|
||||||
|
collision_layer = 256
|
||||||
|
collision_mask = 65553
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cube_279/StaticBody3D" index="0"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cube_279/StaticBody3D" index="0"]
|
||||||
shape = SubResource("ConcavePolygonShape3D_5i7wx")
|
shape = SubResource("ConcavePolygonShape3D_5i7wx")
|
||||||
@@ -28,12 +30,15 @@ shape = SubResource("ConcavePolygonShape3D_5i7wx")
|
|||||||
material_override = ExtResource("4_jmnc2")
|
material_override = ExtResource("4_jmnc2")
|
||||||
|
|
||||||
[node name="StaticBody3D" type="StaticBody3D" parent="Cylinder_001" index="0"]
|
[node name="StaticBody3D" type="StaticBody3D" parent="Cylinder_001" index="0"]
|
||||||
|
collision_layer = 256
|
||||||
|
collision_mask = 65553
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cylinder_001/StaticBody3D" index="0"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Cylinder_001/StaticBody3D" index="0"]
|
||||||
shape = SubResource("ConcavePolygonShape3D_wai75")
|
shape = SubResource("ConcavePolygonShape3D_wai75")
|
||||||
|
|
||||||
[node name="Area3D" type="Area3D" parent="." index="2"]
|
[node name="Area3D" type="Area3D" parent="." index="2"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -36.343, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -36.343, 0)
|
||||||
|
collision_layer = 0
|
||||||
|
|
||||||
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" index="0"]
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="Area3D" index="0"]
|
||||||
shape = SubResource("CylinderShape3D_wai75")
|
shape = SubResource("CylinderShape3D_wai75")
|
||||||
|
|||||||
23
components/damage/CDamageable.cs
Normal file
23
components/damage/CDamageable.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class CDamageable : Node, IDamageable
|
||||||
|
{
|
||||||
|
public event Action<IDamageable, DamageRecord> DamageTaken;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RDamageModifier[] DamageModifiers { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public DamageRecord TakeDamage(DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
var finalDamage = 0f;
|
||||||
|
foreach (var damageable in DamageModifiers.ToIDamageables())
|
||||||
|
finalDamage += damageable.TakeDamage(damageRecord).Damage.DamageDealt;
|
||||||
|
var finalDamageRecord = damageRecord with { Damage = new RDamage(finalDamage, damageRecord.Damage.DamageType) };
|
||||||
|
DamageTaken?.Invoke(this, finalDamageRecord);
|
||||||
|
return finalDamageRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/damage/CDamageable.cs.uid
Normal file
1
components/damage/CDamageable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b0u23nkpaimyc
|
||||||
6
components/damage/CDamageable.tscn
Normal file
6
components/damage/CDamageable.tscn
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://hpsg4fqwrx1u"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://components/damage/CDamageable.cs" id="1_qp8bd"]
|
||||||
|
|
||||||
|
[node name="CDamageable" type="Node"]
|
||||||
|
script = ExtResource("1_qp8bd")
|
||||||
24
components/damage/RDamage.cs
Normal file
24
components/damage/RDamage.cs
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.systems.damage;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RDamage : Resource
|
||||||
|
{
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float DamageDealt = 1.0f;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public EDamageTypes DamageType = EDamageTypes.Normal;
|
||||||
|
|
||||||
|
public RDamage()
|
||||||
|
{
|
||||||
|
DamageDealt = 1.0f;
|
||||||
|
DamageType = EDamageTypes.Normal;
|
||||||
|
}
|
||||||
|
public RDamage(float damageDealt, EDamageTypes damageType)
|
||||||
|
{
|
||||||
|
DamageDealt = damageDealt;
|
||||||
|
DamageType = damageType;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/damage/RDamage.cs.uid
Normal file
1
components/damage/RDamage.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://jitubgv6judn
|
||||||
37
components/damage/RDamageModifier.cs
Normal file
37
components/damage/RDamageModifier.cs
Normal file
@@ -0,0 +1,37 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
using Movementtests.systems.damage;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RDamageModifier : Resource, IDamageable
|
||||||
|
{
|
||||||
|
public event Action<IDamageable, DamageRecord> DamageTaken;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public EDamageTypes DamageType = EDamageTypes.Normal;
|
||||||
|
[Export]
|
||||||
|
public float Modifier = 1.0f;
|
||||||
|
|
||||||
|
public RDamageModifier()
|
||||||
|
{
|
||||||
|
Modifier = 1.0f;
|
||||||
|
DamageType = EDamageTypes.Normal;
|
||||||
|
}
|
||||||
|
public RDamageModifier(EDamageTypes damageType, float modifier)
|
||||||
|
{
|
||||||
|
Modifier = modifier;
|
||||||
|
DamageType = damageType;
|
||||||
|
}
|
||||||
|
|
||||||
|
public DamageRecord TakeDamage(DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
if (damageRecord.Damage.DamageType != DamageType)
|
||||||
|
return damageRecord with { Damage = new RDamage(0, damageRecord.Damage.DamageType) };
|
||||||
|
|
||||||
|
var finalDamage = damageRecord.Damage.DamageDealt * Modifier;
|
||||||
|
var finalDamageRecord = damageRecord with { Damage = new RDamage(finalDamage, damageRecord.Damage.DamageType) };
|
||||||
|
DamageTaken?.Invoke(this, finalDamageRecord);
|
||||||
|
return finalDamageRecord;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/damage/RDamageModifier.cs.uid
Normal file
1
components/damage/RDamageModifier.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b6y3ugfydvch0
|
||||||
33
components/health/CHealth.cs
Normal file
33
components/health/CHealth.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class CHealth : Node, IHealthable
|
||||||
|
{
|
||||||
|
public event Action<IHealthable, float> HealthChanged;
|
||||||
|
public event Action<IHealthable> HealthDepleted;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RHealth RHealth { get; set; }
|
||||||
|
|
||||||
|
public float CurrentHealth { get; set; }
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
CurrentHealth = RHealth.StartingHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReduceHealth(IDamageable source, DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
GD.Print(CurrentHealth);
|
||||||
|
CurrentHealth -= damageRecord.Damage.DamageDealt;
|
||||||
|
HealthChanged?.Invoke(this, CurrentHealth);
|
||||||
|
|
||||||
|
if (CurrentHealth <= 0)
|
||||||
|
{
|
||||||
|
CurrentHealth = 0;
|
||||||
|
HealthDepleted?.Invoke(this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/health/CHealth.cs.uid
Normal file
1
components/health/CHealth.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bjwrpv3jpsc1e
|
||||||
6
components/health/CHealth.tscn
Normal file
6
components/health/CHealth.tscn
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://c4ikbhojckpnc"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://components/health/CHealth.cs" id="1_75uyt"]
|
||||||
|
|
||||||
|
[node name="CHealth" type="Node"]
|
||||||
|
script = ExtResource("1_75uyt")
|
||||||
12
components/health/RDeathEffect.cs
Normal file
12
components/health/RDeathEffect.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RDeathEffect : Resource, IKillable
|
||||||
|
{
|
||||||
|
public void Kill(IHealthable source)
|
||||||
|
{
|
||||||
|
GD.Print($"Death Effect triggered on {source}");
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/health/RDeathEffect.cs.uid
Normal file
1
components/health/RDeathEffect.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b4cwruitopcee
|
||||||
20
components/health/RHealth.cs
Normal file
20
components/health/RHealth.cs
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RHealth : Resource
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public float StartingHealth = 100.0f;
|
||||||
|
|
||||||
|
public RHealth()
|
||||||
|
{
|
||||||
|
StartingHealth = 100.0f;
|
||||||
|
}
|
||||||
|
|
||||||
|
public RHealth(float startingHealth)
|
||||||
|
{
|
||||||
|
StartingHealth = startingHealth;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/health/RHealth.cs.uid
Normal file
1
components/health/RHealth.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://baiapod3csndf
|
||||||
25
components/knockback/CKnockback.cs
Normal file
25
components/knockback/CKnockback.cs
Normal file
@@ -0,0 +1,25 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class CKnockback : Node3D, IKnockbackable
|
||||||
|
{
|
||||||
|
[Export] public RKnockback RKnockback { get; set;}
|
||||||
|
|
||||||
|
private DamageRecord _damageRecord = null;
|
||||||
|
|
||||||
|
public void RegisterKnockback(IDamageable source, DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
_damageRecord = damageRecord;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 ComputeKnockback()
|
||||||
|
{
|
||||||
|
if (_damageRecord == null) return Vector3.Zero;
|
||||||
|
|
||||||
|
var knockbackDirection = GlobalPosition - _damageRecord.Source.GlobalPosition;
|
||||||
|
_damageRecord = null;
|
||||||
|
return knockbackDirection.Normalized() * RKnockback.Modifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/knockback/CKnockback.cs.uid
Normal file
1
components/knockback/CKnockback.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b8dprpcjeac7e
|
||||||
12
components/knockback/CKnockback.tscn
Normal file
12
components/knockback/CKnockback.tscn
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
[gd_scene load_steps=4 format=3 uid="uid://bctpe34ddamg5"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://b8dprpcjeac7e" path="res://components/knockback/CKnockback.cs" id="1_ix2yg"]
|
||||||
|
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://components/knockback/RKnockback.cs" id="2_uqiml"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_gbu2d"]
|
||||||
|
script = ExtResource("2_uqiml")
|
||||||
|
metadata/_custom_type_script = "uid://b44cse62qru7j"
|
||||||
|
|
||||||
|
[node name="CKnockback" type="Node3D"]
|
||||||
|
script = ExtResource("1_ix2yg")
|
||||||
|
RKnockback = SubResource("Resource_gbu2d")
|
||||||
19
components/knockback/RKnockback.cs
Normal file
19
components/knockback/RKnockback.cs
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RKnockback : Resource
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public float Modifier = 1.0f;
|
||||||
|
|
||||||
|
public RKnockback()
|
||||||
|
{
|
||||||
|
Modifier = 1.0f;
|
||||||
|
}
|
||||||
|
public RKnockback(float modifier)
|
||||||
|
{
|
||||||
|
Modifier = modifier;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/knockback/RKnockback.cs.uid
Normal file
1
components/knockback/RKnockback.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b44cse62qru7j
|
||||||
61
components/movement/CFlyingMovement.cs
Normal file
61
components/movement/CFlyingMovement.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using Godot;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
namespace Movementtests.scenes.movement;
|
||||||
|
|
||||||
|
public partial class CFlyingMovement : Node3D, IMoveable
|
||||||
|
{
|
||||||
|
[Export] public RMovement RMovement { get; set; }
|
||||||
|
|
||||||
|
[Export(PropertyHint.Layers3DPhysics)]
|
||||||
|
public uint TerrainCollision { get; set; } = 1;
|
||||||
|
|
||||||
|
private bool _movingToDesiredHeight = true;
|
||||||
|
private Vector3 _randomDirection;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_randomDirection = new Vector3(GD.RandRange(-1, 1), 1, GD.RandRange(-1, 1)).Normalized();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 ComputeVelocity(MovementInputs inputs)
|
||||||
|
{
|
||||||
|
var velocity = inputs.Velocity;
|
||||||
|
var spaceState = GetWorld3D().DirectSpaceState;
|
||||||
|
var target = inputs.TargetLocation;
|
||||||
|
var direction = (target - GlobalPosition).Normalized();
|
||||||
|
// Check if we have a direct line of sight to the player
|
||||||
|
if (!_movingToDesiredHeight)
|
||||||
|
{
|
||||||
|
velocity = velocity.Lerp(direction * RMovement.Speed, (float) inputs.delta * RMovement.Acceleration);
|
||||||
|
|
||||||
|
var query = PhysicsRayQueryParameters3D.Create(GlobalPosition, target, TerrainCollision);
|
||||||
|
var result = spaceState.IntersectRay(query);
|
||||||
|
if (result.Count > 0)
|
||||||
|
{
|
||||||
|
_movingToDesiredHeight = true;
|
||||||
|
_randomDirection = new Vector3(GD.RandRange(-1, 1), 1, GD.RandRange(-1, 1)).Normalized();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
velocity = velocity.Lerp(_randomDirection * RMovement.Speed, (float) inputs.delta * RMovement.Acceleration);
|
||||||
|
|
||||||
|
var groundQuery = PhysicsRayQueryParameters3D.Create(GlobalPosition, GlobalPosition+Vector3.Down*RMovement.TargetHeight, TerrainCollision);
|
||||||
|
var groundResult = spaceState.IntersectRay(groundQuery);
|
||||||
|
if (groundResult.Count == 0)
|
||||||
|
{
|
||||||
|
velocity.Y = 0;
|
||||||
|
|
||||||
|
var query = PhysicsRayQueryParameters3D.Create(GlobalPosition, target, TerrainCollision);
|
||||||
|
var result = spaceState.IntersectRay(query);
|
||||||
|
if (result.Count == 0)
|
||||||
|
{
|
||||||
|
_movingToDesiredHeight = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/movement/CFlyingMovement.cs.uid
Normal file
1
components/movement/CFlyingMovement.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cps1rbkxs3nvq
|
||||||
7
components/movement/CFlyingMovement.tscn
Normal file
7
components/movement/CFlyingMovement.tscn
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dmw5ibwrb483f"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://cps1rbkxs3nvq" path="res://components/movement/CFlyingMovement.cs" id="1_i26q2"]
|
||||||
|
|
||||||
|
[node name="CFlyingMovement" type="Node3D"]
|
||||||
|
script = ExtResource("1_i26q2")
|
||||||
|
CollisionMask = 256
|
||||||
34
components/movement/CGroundedMovement.cs
Normal file
34
components/movement/CGroundedMovement.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using Godot;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
namespace Movementtests.scenes.movement;
|
||||||
|
|
||||||
|
public partial class CGroundedMovement : Node3D, IMoveable
|
||||||
|
{
|
||||||
|
[Export] public RMovement RMovement { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RayCast3D WallInFrontRayCast { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public Vector3 ComputeVelocity(MovementInputs inputs)
|
||||||
|
{
|
||||||
|
var velocity = inputs.Velocity;
|
||||||
|
var target = inputs.TargetLocation;
|
||||||
|
var direction = (target - GlobalPosition).Normalized();
|
||||||
|
|
||||||
|
var targetPlane = new Vector3(target.X, GlobalPosition.Y, target.Z);
|
||||||
|
LookAt(targetPlane);
|
||||||
|
float xAcc = (float) Mathf.Lerp(velocity.X, direction.X * RMovement.Speed, inputs.delta * RMovement.Acceleration);
|
||||||
|
float zAcc = (float) Mathf.Lerp(velocity.Z, direction.Z * RMovement.Speed, inputs.delta * RMovement.Acceleration);
|
||||||
|
velocity.X = xAcc;
|
||||||
|
velocity.Z = zAcc;
|
||||||
|
|
||||||
|
if (WallInFrontRayCast.IsColliding())
|
||||||
|
velocity.Y = RMovement.Speed;
|
||||||
|
else if (!inputs.isOnFloor)
|
||||||
|
velocity += inputs.gravity * (float)inputs.delta * RMovement.GravityModifier;
|
||||||
|
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/movement/CGroundedMovement.cs.uid
Normal file
1
components/movement/CGroundedMovement.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bdag2eeixw2lt
|
||||||
6
components/movement/CGroundedMovement.tscn
Normal file
6
components/movement/CGroundedMovement.tscn
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
[gd_scene load_steps=2 format=3 uid="uid://dbr7ioio158ew"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bdag2eeixw2lt" path="res://components/movement/CGroundedMovement.cs" id="1_e0agf"]
|
||||||
|
|
||||||
|
[node name="CGroundedMovement" type="Node3D"]
|
||||||
|
script = ExtResource("1_e0agf")
|
||||||
31
components/movement/RMovement.cs
Normal file
31
components/movement/RMovement.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RMovement : Resource
|
||||||
|
{
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float Speed { get; set;}
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float Acceleration { get; set;}
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float GravityModifier { get; set;}
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "0,20,1,or_greater")]
|
||||||
|
public float TargetHeight { get; set;}
|
||||||
|
|
||||||
|
public RMovement()
|
||||||
|
{
|
||||||
|
Speed = 3.0f;
|
||||||
|
Acceleration = 1.0f;
|
||||||
|
GravityModifier = 1.0f;
|
||||||
|
TargetHeight = 10.0f;
|
||||||
|
}
|
||||||
|
public RMovement(float speed, float acceleration, float gravityModifier, float targetHeight)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
Acceleration = acceleration;
|
||||||
|
GravityModifier = gravityModifier;
|
||||||
|
TargetHeight = targetHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
components/movement/RMovement.cs.uid
Normal file
1
components/movement/RMovement.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dtpxijlnb2c5
|
||||||
9
interfaces/IDamageDealer.cs
Normal file
9
interfaces/IDamageDealer.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IDamageDealer
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
RDamage RDamage { get; set; }
|
||||||
|
}
|
||||||
1
interfaces/IDamageDealer.cs.uid
Normal file
1
interfaces/IDamageDealer.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://wdqo51131g5
|
||||||
12
interfaces/IDamageable.cs
Normal file
12
interfaces/IDamageable.cs
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
using System;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public record DamageRecord(Node3D Source, RDamage Damage);
|
||||||
|
|
||||||
|
public interface IDamageable
|
||||||
|
{
|
||||||
|
event Action<IDamageable, DamageRecord> DamageTaken;
|
||||||
|
DamageRecord TakeDamage(DamageRecord damageRecord);
|
||||||
|
}
|
||||||
1
interfaces/IDamageable.cs.uid
Normal file
1
interfaces/IDamageable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cf56b2ep3bu3j
|
||||||
16
interfaces/IHealthable.cs
Normal file
16
interfaces/IHealthable.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using System;
|
||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IHealthable
|
||||||
|
{
|
||||||
|
event Action<IHealthable, float> HealthChanged;
|
||||||
|
event Action<IHealthable> HealthDepleted;
|
||||||
|
|
||||||
|
[Export] RHealth RHealth { get; set; }
|
||||||
|
|
||||||
|
float CurrentHealth { get; set; }
|
||||||
|
|
||||||
|
void ReduceHealth(IDamageable source, DamageRecord damageRecord);
|
||||||
|
}
|
||||||
1
interfaces/IHealthable.cs.uid
Normal file
1
interfaces/IHealthable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bea2kvnu3kuhu
|
||||||
6
interfaces/IKillable.cs
Normal file
6
interfaces/IKillable.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IKillable
|
||||||
|
{
|
||||||
|
void Kill(IHealthable source);
|
||||||
|
}
|
||||||
1
interfaces/IKillable.cs.uid
Normal file
1
interfaces/IKillable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dqpjr2d01sk1a
|
||||||
11
interfaces/IKnockbackable.cs
Normal file
11
interfaces/IKnockbackable.cs
Normal file
@@ -0,0 +1,11 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IKnockbackable
|
||||||
|
{
|
||||||
|
[Export] RKnockback RKnockback { get; set;}
|
||||||
|
|
||||||
|
public void RegisterKnockback(IDamageable source, DamageRecord damageRecord);
|
||||||
|
public Vector3 ComputeKnockback();
|
||||||
|
}
|
||||||
1
interfaces/IKnockbackable.cs.uid
Normal file
1
interfaces/IKnockbackable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bh06s1yefucf7
|
||||||
16
interfaces/IMoveable.cs
Normal file
16
interfaces/IMoveable.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public record MovementInputs(
|
||||||
|
Vector3 Velocity = default,
|
||||||
|
Vector3 TargetLocation = default,
|
||||||
|
bool isOnFloor = false,
|
||||||
|
Vector3 gravity = default,
|
||||||
|
double delta = 0);
|
||||||
|
|
||||||
|
public interface IMoveable
|
||||||
|
{
|
||||||
|
[Export] RMovement RMovement { get; set; }
|
||||||
|
Vector3 ComputeVelocity(MovementInputs inputs);
|
||||||
|
}
|
||||||
1
interfaces/IMoveable.cs.uid
Normal file
1
interfaces/IMoveable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dp6v42a2iwlbs
|
||||||
7
interfaces/ISpawnable.cs
Normal file
7
interfaces/ISpawnable.cs
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
|
||||||
|
interface ISpawnable
|
||||||
|
{
|
||||||
|
void Initialize();
|
||||||
|
}
|
||||||
1
interfaces/ISpawnable.cs.uid
Normal file
1
interfaces/ISpawnable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bethuw2c1at8o
|
||||||
16
interfaces/NodeExtensions.cs
Normal file
16
interfaces/NodeExtensions.cs
Normal file
@@ -0,0 +1,16 @@
|
|||||||
|
using Godot;
|
||||||
|
using System.Linq;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public static class NodeExtensions
|
||||||
|
{
|
||||||
|
public static IDamageable[] ToIDamageables(this GodotObject[] nodes)
|
||||||
|
{
|
||||||
|
return nodes == null ? System.Array.Empty<IDamageable>() : nodes.OfType<IDamageable>().ToArray();
|
||||||
|
}
|
||||||
|
public static IKillable[] ToIKillables(this GodotObject[] nodes)
|
||||||
|
{
|
||||||
|
return nodes == null ? System.Array.Empty<IKillable>() : nodes.OfType<IKillable>().ToArray();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
interfaces/NodeExtensions.cs.uid
Normal file
1
interfaces/NodeExtensions.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bgnncty7axdwd
|
||||||
156
maps/GYMs/enemies.tscn
Normal file
156
maps/GYMs/enemies.tscn
Normal file
@@ -0,0 +1,156 @@
|
|||||||
|
[gd_scene load_steps=20 format=3 uid="uid://q7uc1h2jpbd2"]
|
||||||
|
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bei4nhkf8lwdo" path="res://player_controller/PlayerController.tscn" id="1_62kkh"]
|
||||||
|
[ext_resource type="Material" uid="uid://31aulub2nqov" path="res://assets/greybox/m_greybox.tres" id="2_3uydm"]
|
||||||
|
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://components/damage/RDamage.cs" id="2_sysok"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="3_3uydm"]
|
||||||
|
[ext_resource type="Script" uid="uid://b4cwruitopcee" path="res://components/health/RDeathEffect.cs" id="5_7m3bq"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="5_8fd2t"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="6_7m3bq"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="7_caohq"]
|
||||||
|
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://components/health/RHealth.cs" id="9_2e4ci"]
|
||||||
|
[ext_resource type="Resource" uid="uid://otfc2snh8umc" path="res://scenes/enemies/grounded_enemy/grounded_enemy_damage.tres" id="9_dmw1t"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="9_gp7s3"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="10_spw1u"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dg1xbjhyhgnnk" path="res://scenes/enemies/flying_enemy/flying_enemy_health.tres" id="11_2e4ci"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_2e4ci"]
|
||||||
|
script = ExtResource("2_sysok")
|
||||||
|
metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||||
|
|
||||||
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_0xm2m"]
|
||||||
|
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||||
|
ground_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||||
|
|
||||||
|
[sub_resource type="Sky" id="Sky_h2yge"]
|
||||||
|
sky_material = SubResource("ProceduralSkyMaterial_0xm2m")
|
||||||
|
|
||||||
|
[sub_resource type="Environment" id="Environment_1bvp3"]
|
||||||
|
background_mode = 2
|
||||||
|
sky = SubResource("Sky_h2yge")
|
||||||
|
ambient_light_source = 2
|
||||||
|
ambient_light_color = Color(0.576076, 0.459788, 0.652401, 1)
|
||||||
|
reflected_light_source = 2
|
||||||
|
tonemap_mode = 4
|
||||||
|
tonemap_exposure = 1.32
|
||||||
|
ssao_enabled = true
|
||||||
|
ssao_radius = 3.61
|
||||||
|
ssil_enabled = true
|
||||||
|
ssil_radius = 8.4
|
||||||
|
sdfgi_use_occlusion = true
|
||||||
|
glow_enabled = true
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_sysok"]
|
||||||
|
script = ExtResource("5_7m3bq")
|
||||||
|
metadata/_custom_type_script = "uid://b4cwruitopcee"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_ybosk"]
|
||||||
|
script = ExtResource("9_2e4ci")
|
||||||
|
StartingHealth = 1.0
|
||||||
|
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||||
|
|
||||||
|
[node name="Main" type="Node3D"]
|
||||||
|
|
||||||
|
[node name="Player" parent="." instance=ExtResource("1_62kkh")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 7.5)
|
||||||
|
TutorialDone = true
|
||||||
|
RDamage = SubResource("Resource_2e4ci")
|
||||||
|
|
||||||
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
|
environment = SubResource("Environment_1bvp3")
|
||||||
|
|
||||||
|
[node name="DirectionalLight3D" type="DirectionalLight3D" parent="."]
|
||||||
|
transform = Transform3D(-0.772218, 0.611111, 0.173844, 0.0446935, -0.220691, 0.974319, 0.633783, 0.760157, 0.143109, 0, 0, 0)
|
||||||
|
shadow_enabled = true
|
||||||
|
|
||||||
|
[node name="Greybox" type="CSGCombiner3D" parent="."]
|
||||||
|
use_collision = true
|
||||||
|
collision_layer = 256
|
||||||
|
collision_mask = 65553
|
||||||
|
|
||||||
|
[node name="CSGBox3D" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.096, -0.5, -46.329)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(100, 1, 190.741)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="CSGBox3D2" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -21.346, 4.5, 2.7915)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(6.5, 11, 5.5)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="CSGBox3D6" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(0.70710677, 0, -0.70710677, 0, 1, 0, 0.70710677, 0, 0.70710677, -15.846001, 2.75, 2.0415)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(6.5, 7.5, 11)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="CSGBox3D7" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -10.346001, 1, 1.0415001)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(6.5, 4, 17)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="CSGBox3D8" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(0.81915206, 0, 0.57357645, 0, 1, 0, -0.57357645, 0, 0.81915206, -7.3460007, 0, -3.9585)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(6.5, 4, 17)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="CSGBox3D3" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.154, 4.5, 2.7915)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(6.5, 11, 5.5)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="CSGBox3D4" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18.154, 4.5, -14.2085)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(6.5, 11, 5.5)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="CSGBox3D5" type="CSGBox3D" parent="Greybox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.8460007, 4.5, 17.7915)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(6.5, 11, 5.5)
|
||||||
|
material = ExtResource("2_3uydm")
|
||||||
|
|
||||||
|
[node name="Enemy" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_3uydm")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -16.83681)
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
DeathEffects = Array[Object]([SubResource("Resource_sysok")])
|
||||||
|
|
||||||
|
[node name="Enemy2" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_3uydm")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, -16.83681)
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
|
||||||
|
[node name="Enemy3" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_3uydm")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, -16.83681)
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
|
||||||
|
[node name="FlyingEnemy" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("5_8fd2t")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 8, 7, -16)
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
|
||||||
|
[node name="FlyingEnemy2" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("5_8fd2t")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 10, 7, -16)
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
|
||||||
|
[node name="GroundedSpawner" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("6_7m3bq")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 2.5, -15)
|
||||||
|
EnemyToSpawn = ExtResource("3_3uydm")
|
||||||
|
MovementInputs = ExtResource("7_caohq")
|
||||||
|
HealthInputs = SubResource("Resource_ybosk")
|
||||||
|
DamageInputs = ExtResource("9_dmw1t")
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
IsActiveOnStart = false
|
||||||
|
|
||||||
|
[node name="FlyingSpawner" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("6_7m3bq")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 18, 11, -14)
|
||||||
|
EnemyToSpawn = ExtResource("5_8fd2t")
|
||||||
|
MovementInputs = ExtResource("10_spw1u")
|
||||||
|
HealthInputs = ExtResource("11_2e4ci")
|
||||||
|
DamageInputs = ExtResource("9_gp7s3")
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
IsActiveOnStart = false
|
||||||
@@ -30,6 +30,7 @@ glow_enabled = true
|
|||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("1_ig7tw")]
|
[node name="Player" parent="." instance=ExtResource("1_ig7tw")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.7981, 1.6118, 39.3006)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -2.7981, 1.6118, 39.3006)
|
||||||
|
TutorialDone = true
|
||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
environment = SubResource("Environment_1bvp3")
|
environment = SubResource("Environment_1bvp3")
|
||||||
|
|||||||
@@ -46,8 +46,8 @@ visible = false
|
|||||||
|
|
||||||
[node name="Greybox" type="CSGCombiner3D" parent="."]
|
[node name="Greybox" type="CSGCombiner3D" parent="."]
|
||||||
use_collision = true
|
use_collision = true
|
||||||
collision_layer = 3
|
collision_layer = 256
|
||||||
collision_mask = 5
|
collision_mask = 65553
|
||||||
|
|
||||||
[node name="CSGBox3D" type="CSGBox3D" parent="Greybox"]
|
[node name="CSGBox3D" type="CSGBox3D" parent="Greybox"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.096, -0.5, -46.329)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -1.096, -0.5, -46.329)
|
||||||
@@ -133,6 +133,21 @@ material = ExtResource("3_vvhq3")
|
|||||||
transform = Transform3D(5, 0, 0, 0, -2.18557e-07, 5, 0, -5, -2.18557e-07, 1, 0.1, -9.5)
|
transform = Transform3D(5, 0, 0, 0, -2.18557e-07, 5, 0, -5, -2.18557e-07, 1, 0.1, -9.5)
|
||||||
text = "10m"
|
text = "10m"
|
||||||
|
|
||||||
|
[node name="Label3D6" type="Label3D" parent="Greybox/RunningTrack"]
|
||||||
|
transform = Transform3D(5, 0, 0, 0, -2.18557e-07, 5, 0, -5, -2.18557e-07, 27.5, 0.1, 1)
|
||||||
|
text = "10deg
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="Label3D7" type="Label3D" parent="Greybox/RunningTrack"]
|
||||||
|
transform = Transform3D(5, 0, 0, 0, -2.18557e-07, 5, 0, -5, -2.18557e-07, 30.5, 0.1, 1)
|
||||||
|
text = "20deg
|
||||||
|
"
|
||||||
|
|
||||||
|
[node name="Label3D8" type="Label3D" parent="Greybox/RunningTrack"]
|
||||||
|
transform = Transform3D(5, 0, 0, 0, -2.18557e-07, 5, 0, -5, -2.18557e-07, 33.5, 0.1, 1)
|
||||||
|
text = "30deg
|
||||||
|
"
|
||||||
|
|
||||||
[node name="Label3D2" type="Label3D" parent="Greybox/RunningTrack"]
|
[node name="Label3D2" type="Label3D" parent="Greybox/RunningTrack"]
|
||||||
transform = Transform3D(5, 0, 0, 0, -2.18557e-07, 5, 0, -5, -2.18557e-07, 1, 0.1, -19.5)
|
transform = Transform3D(5, 0, 0, 0, -2.18557e-07, 5, 0, -5, -2.18557e-07, 1, 0.1, -19.5)
|
||||||
text = "20m"
|
text = "20m"
|
||||||
@@ -367,6 +382,60 @@ use_collision = true
|
|||||||
size = Vector3(7.5, 20, 10)
|
size = Vector3(7.5, 20, 10)
|
||||||
material = ExtResource("3_vvhq3")
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D41" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 22.75, 5, -1.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(12.5, 10, 3)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D47" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.9848078, 0.17364816, 0, -0.17364816, 0.9848078, 22.75, 0.03095889, -30.695885)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(12.5, 10, 58)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D48" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.9396926, 0.34202012, 0, -0.34202012, 0.9396926, 30.5, 1.5878377, -16.713436)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(3, 6.5, 31.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D49" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 0.86602545, 0.5, 0, -0.5, 0.86602545, 33.5, 2.5053406, -10.524445)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(3, 5.5, 20.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D42" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 30.5, 5, -1.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(3, 10, 3)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D43" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 33.5, 5, -1.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(3, 10, 3)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D44" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 36.5, 5, -1.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(3, 10, 3)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D45" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 39.5, 5, -1.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(3, 10, 3)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D46" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 42.5, 5, -1.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(3, 10, 3)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
[node name="CSGBox3D34" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
[node name="CSGBox3D34" type="CSGBox3D" parent="Greybox/JumpHeights"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -24.5, 10, -15)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -24.5, 10, -15)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
@@ -437,6 +506,162 @@ use_collision = true
|
|||||||
size = Vector3(5, 3, 2)
|
size = Vector3(5, 3, 2)
|
||||||
material = ExtResource("3_vvhq3")
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D38" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 21.5, 2.25, 22.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D39" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 21.25, 0.5, 22.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D40" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 28.5, 2.25, 22.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D41" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 28.25, 0.25, 22.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 2.5, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D42" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 35.5, 2.25, 22.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D43" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 35.25, -0.5, 22.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D44" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 42.5, 2.25, 22.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D45" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-4.371139e-08, 0, -1, 0, 1, 0, 1, 0, -4.371139e-08, 42.25, -1, 22.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D46" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 21.5, 2.25, 31.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D47" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 21.25, 0.5, 31.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D48" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 28.5, 2.25, 31.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D49" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 28.25, 0.25, 31.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 2.5, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D50" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 35.5, 2.25, 31.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D51" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 35.25, -0.5, 31.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D52" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 42.5, 2.25, 31.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D53" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-2.6226834e-08, 0, -1, 0, 1, 0, 0.6, 0, -4.371139e-08, 42.25, -1, 31.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D54" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 21.5, 2.25, 39.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D55" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 21.25, 0.5, 39.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D56" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 28.5, 2.25, 39.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D57" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 28.25, 0.25, 39.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 2.5, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D58" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 35.5, 2.25, 39.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D59" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 35.25, -0.5, 39.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D60" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 42.5, 2.25, 39.5)
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 5, 5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
|
[node name="CSGBox3D61" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
|
transform = Transform3D(-7.86805e-09, 0, -1, 0, 1, 0, 0.18, 0, -4.371139e-08, 42.25, -1, 39.5)
|
||||||
|
operation = 2
|
||||||
|
use_collision = true
|
||||||
|
size = Vector3(5, 3, 1.5)
|
||||||
|
material = ExtResource("3_vvhq3")
|
||||||
|
|
||||||
[node name="CSGBox3D32" type="CSGBox3D" parent="Greybox/Passageways"]
|
[node name="CSGBox3D32" type="CSGBox3D" parent="Greybox/Passageways"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 2.25, -26.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 12, 2.25, -26.5)
|
||||||
use_collision = true
|
use_collision = true
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_scene load_steps=40 format=3 uid="uid://dmkw8cmalm5k"]
|
[gd_scene load_steps=45 format=3 uid="uid://dmkw8cmalm5k"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bei4nhkf8lwdo" path="res://player_controller/PlayerController.tscn" id="1_2vsi6"]
|
[ext_resource type="PackedScene" uid="uid://bei4nhkf8lwdo" path="res://player_controller/PlayerController.tscn" id="1_2vsi6"]
|
||||||
[ext_resource type="Script" uid="uid://blenis2y55fmg" path="res://tools/city_helpers.gd" id="1_qwuk2"]
|
[ext_resource type="Script" uid="uid://blenis2y55fmg" path="res://tools/city_helpers.gd" id="1_qwuk2"]
|
||||||
@@ -23,6 +23,10 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://cjh5cnvdbq5ku" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_button_b_outline.svg" id="19_efsse"]
|
[ext_resource type="Texture2D" uid="uid://cjh5cnvdbq5ku" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_button_b_outline.svg" id="19_efsse"]
|
||||||
[ext_resource type="Texture2D" uid="uid://nrhxjdpuje3f" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_lt_outline.svg" id="20_crf87"]
|
[ext_resource type="Texture2D" uid="uid://nrhxjdpuje3f" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_lt_outline.svg" id="20_crf87"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dyjvbsvbriii4" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_rb_outline.svg" id="23_p287n"]
|
[ext_resource type="Texture2D" uid="uid://dyjvbsvbriii4" path="res://assets/ui/input-prompts/Xbox Series/Vector/xbox_rb_outline.svg" id="23_p287n"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://c305mfrtumcyq" path="res://scenes/spawners/spawner.tscn" id="24_qwuk2"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="25_nrosh"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="25_x7fl1"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://components/movement/RMovement.cs" id="26_lu3yt"]
|
||||||
|
|
||||||
[sub_resource type="LabelSettings" id="LabelSettings_2k3fr"]
|
[sub_resource type="LabelSettings" id="LabelSettings_2k3fr"]
|
||||||
font_size = 30
|
font_size = 30
|
||||||
@@ -89,6 +93,12 @@ adjustment_enabled = true
|
|||||||
|
|
||||||
[sub_resource type="BoxMesh" id="BoxMesh_p287n"]
|
[sub_resource type="BoxMesh" id="BoxMesh_p287n"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_pxspk"]
|
||||||
|
script = ExtResource("26_lu3yt")
|
||||||
|
Speed = 7.0
|
||||||
|
TargetHeight = 15.0
|
||||||
|
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
|
||||||
|
|
||||||
[node name="Main" type="Node3D"]
|
[node name="Main" type="Node3D"]
|
||||||
script = ExtResource("1_qwuk2")
|
script = ExtResource("1_qwuk2")
|
||||||
|
|
||||||
@@ -436,6 +446,17 @@ spot_range = 47.233
|
|||||||
spot_angle = 18.85
|
spot_angle = 18.85
|
||||||
spot_angle_attenuation = 10.556052
|
spot_angle_attenuation = 10.556052
|
||||||
|
|
||||||
|
[node name="Spawner" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("24_qwuk2")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 19, 43, -111.5)
|
||||||
|
EnemyToSpawn = ExtResource("25_x7fl1")
|
||||||
|
MovementInputs = SubResource("Resource_pxspk")
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
|
||||||
|
[node name="Spawner2" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("24_qwuk2")]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 31, 7.5, -88)
|
||||||
|
EnemyToSpawn = ExtResource("25_nrosh")
|
||||||
|
Target = NodePath("../Player")
|
||||||
|
|
||||||
[connection signal="timeout" from="TutorialController/WaitToShowBlockingTuto" to="TutorialController" method="_show_weapon_tutorial"]
|
[connection signal="timeout" from="TutorialController/WaitToShowBlockingTuto" to="TutorialController" method="_show_weapon_tutorial"]
|
||||||
[connection signal="body_exited" from="TutoTriggers/TriggerTutoMove" to="TutorialController" method="hide_tutorials"]
|
[connection signal="body_exited" from="TutoTriggers/TriggerTutoMove" to="TutorialController" method="hide_tutorials"]
|
||||||
[connection signal="body_entered" from="TutoTriggers/TriggerTutoMantle" to="TutorialController" method="_on_tuto_mantle_body_entered"]
|
[connection signal="body_entered" from="TutoTriggers/TriggerTutoMantle" to="TutorialController" method="_on_tuto_mantle_body_entered"]
|
||||||
|
|||||||
@@ -1,17 +1,18 @@
|
|||||||
[gd_scene load_steps=49 format=3 uid="uid://bei4nhkf8lwdo"]
|
[gd_scene load_steps=54 format=3 uid="uid://bei4nhkf8lwdo"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
[ext_resource type="Script" uid="uid://bbbrf5ckydfna" path="res://player_controller/Scripts/PlayerController.cs" id="1_poq2x"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cf3rrgr1imvv4" path="res://scenes/path/path.tscn" id="2_6lejt"]
|
[ext_resource type="PackedScene" uid="uid://cf3rrgr1imvv4" path="res://scenes/path/path.tscn" id="2_6lejt"]
|
||||||
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
[ext_resource type="Resource" uid="uid://bl5crtu1gkrtr" path="res://systems/inputs/base_mode/base_mode.tres" id="3_cresl"]
|
||||||
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://components/damage/CDamageable.cs" id="4_q7bng"]
|
||||||
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://systems/inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
[ext_resource type="Resource" uid="uid://cpdaw41ah5gic" path="res://systems/inputs/base_mode/rotate_y.tres" id="4_rxwoh"]
|
||||||
[ext_resource type="Resource" uid="uid://ccrb5xsnphc8" path="res://systems/inputs/base_mode/rotate_floorplane.tres" id="5_4u7i3"]
|
[ext_resource type="Resource" uid="uid://ccrb5xsnphc8" path="res://systems/inputs/base_mode/rotate_floorplane.tres" id="5_4u7i3"]
|
||||||
|
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://components/damage/RDamageModifier.cs" id="5_q7bng"]
|
||||||
[ext_resource type="Resource" uid="uid://f3vs6l4m623s" path="res://systems/inputs/base_mode/move_left.tres" id="5_q14ux"]
|
[ext_resource type="Resource" uid="uid://f3vs6l4m623s" path="res://systems/inputs/base_mode/move_left.tres" id="5_q14ux"]
|
||||||
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://systems/inputs/base_mode/move_right.tres" id="6_q7bng"]
|
[ext_resource type="Resource" uid="uid://t612lts1wi1s" path="res://systems/inputs/base_mode/move_right.tres" id="6_q7bng"]
|
||||||
[ext_resource type="Script" uid="uid://cwbvxlfvmocc1" path="res://player_controller/Scripts/StairsSystem.cs" id="7_bmt5a"]
|
[ext_resource type="Script" uid="uid://cwbvxlfvmocc1" path="res://player_controller/Scripts/StairsSystem.cs" id="7_bmt5a"]
|
||||||
[ext_resource type="Resource" uid="uid://brswsknpgwal2" path="res://systems/inputs/base_mode/move_front.tres" id="7_m8gvy"]
|
[ext_resource type="Resource" uid="uid://brswsknpgwal2" path="res://systems/inputs/base_mode/move_front.tres" id="7_m8gvy"]
|
||||||
[ext_resource type="Resource" uid="uid://s1l0n1iitc6m" path="res://systems/inputs/base_mode/move_back.tres" id="8_jb43f"]
|
[ext_resource type="Resource" uid="uid://s1l0n1iitc6m" path="res://systems/inputs/base_mode/move_back.tres" id="8_jb43f"]
|
||||||
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://systems/inputs/base_mode/aim_release.tres" id="8_lhb11"]
|
[ext_resource type="Resource" uid="uid://j1o5ud0plk4" path="res://systems/inputs/base_mode/aim_release.tres" id="8_lhb11"]
|
||||||
[ext_resource type="Script" uid="uid://dd1yrt7eiiyf4" path="res://player_controller/Scripts/CapsuleCollider.cs" id="8_lmtjd"]
|
|
||||||
[ext_resource type="Resource" uid="uid://c3e0ivgaxrsyb" path="res://systems/inputs/base_mode/aim_down.tres" id="8_obsfv"]
|
[ext_resource type="Resource" uid="uid://c3e0ivgaxrsyb" path="res://systems/inputs/base_mode/aim_down.tres" id="8_obsfv"]
|
||||||
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle/mantle_system.tscn" id="8_qu4wy"]
|
[ext_resource type="PackedScene" uid="uid://wq1okogkhc5l" path="res://systems/mantle/mantle_system.tscn" id="8_qu4wy"]
|
||||||
[ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://systems/inputs/base_mode/aim_pressed.tres" id="9_nob5r"]
|
[ext_resource type="Resource" uid="uid://bebstkm608wxx" path="res://systems/inputs/base_mode/aim_pressed.tres" id="9_nob5r"]
|
||||||
@@ -44,9 +45,20 @@
|
|||||||
[ext_resource type="Texture2D" uid="uid://chvt6g0xn5c2m" path="res://systems/dash/light-ring.jpg" id="32_lgpc8"]
|
[ext_resource type="Texture2D" uid="uid://chvt6g0xn5c2m" path="res://systems/dash/light-ring.jpg" id="32_lgpc8"]
|
||||||
[ext_resource type="Script" uid="uid://b4dwolbvt8our" path="res://addons/godot_state_charts/history_state.gd" id="41_ruloh"]
|
[ext_resource type="Script" uid="uid://b4dwolbvt8our" path="res://addons/godot_state_charts/history_state.gd" id="41_ruloh"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_jb43f"]
|
||||||
|
script = ExtResource("5_q7bng")
|
||||||
|
Modifier = 3.0
|
||||||
|
metadata/_custom_type_script = "uid://b6y3ugfydvch0"
|
||||||
|
|
||||||
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_xc2g5"]
|
||||||
height = 1.7
|
height = 1.7
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_6lejt"]
|
||||||
|
radius = 0.45
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_q14ux"]
|
||||||
|
radius = 1.0
|
||||||
|
|
||||||
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nodcl"]
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_nodcl"]
|
||||||
transparency = 1
|
transparency = 1
|
||||||
albedo_color = Color(0, 0.627451, 0.6313726, 0.49019608)
|
albedo_color = Color(0, 0.627451, 0.6313726, 0.49019608)
|
||||||
@@ -59,13 +71,18 @@ height = 1.0
|
|||||||
|
|
||||||
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_6lejt"]
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_6lejt"]
|
||||||
radius = 1.0
|
radius = 1.0
|
||||||
height = 3.0
|
height = 3.5
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_nob5r"]
|
||||||
|
radius = 0.4
|
||||||
|
|
||||||
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
[sub_resource type="CanvasItemMaterial" id="CanvasItemMaterial_2q0ik"]
|
||||||
blend_mode = 1
|
blend_mode = 1
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody3D"]
|
[node name="Player" type="CharacterBody3D" node_paths=PackedStringArray("CDamage")]
|
||||||
|
collision_mask = 272
|
||||||
script = ExtResource("1_poq2x")
|
script = ExtResource("1_poq2x")
|
||||||
|
CDamage = NodePath("CDamageable")
|
||||||
WalkSpeed = 7.5
|
WalkSpeed = 7.5
|
||||||
AccelerationFloor = 4.0
|
AccelerationFloor = 4.0
|
||||||
DecelerationFloor = 3.0
|
DecelerationFloor = 3.0
|
||||||
@@ -84,22 +101,35 @@ DoubleJumpHangTimeInFrames = 3
|
|||||||
DoubleJumpGravityLesseningFactor = 1.5
|
DoubleJumpGravityLesseningFactor = 1.5
|
||||||
WallJumpStartVelocity = 8.0
|
WallJumpStartVelocity = 8.0
|
||||||
MaxNumberOfEmpoweredActions = 3
|
MaxNumberOfEmpoweredActions = 3
|
||||||
SimpleDashStrength = 15.0
|
SimpleDashStrength = 18.0
|
||||||
|
SimpleDashTime = 0.2
|
||||||
AimedDashTime = 0.2
|
AimedDashTime = 0.2
|
||||||
PostDashSpeed = 30.0
|
PostDashSpeed = 30.0
|
||||||
AccelerationGroundSlide = 0.2
|
SlamSpeed = 80.0
|
||||||
AirGlideVSpeed = 3.0
|
FlatGroundSlideSpeedLossRate = 0.996
|
||||||
AccelerationAirGlide = 0.2
|
GroundSlideJumpMultiplier = 0.1
|
||||||
DecelerationAirGlide = 0.0
|
GroundSlideJumpSpeedFactor = 0.1
|
||||||
|
GroundSlideDownSlopeAcceleration = 0.2
|
||||||
|
GroundSlideDownSlopeMaxSpeed = 30.0
|
||||||
|
AirGlideVSpeed = 4.0
|
||||||
|
AccelerationAirGlide = 0.4
|
||||||
|
AirGlideVerticalAcceleration = 8.0
|
||||||
|
AirGlideJumpMultiplier = 0.1
|
||||||
|
AirGlideJumpSpeedFactor = 0.05
|
||||||
WallHugGravityLesseningFactor = 15.0
|
WallHugGravityLesseningFactor = 15.0
|
||||||
WallHugDownwardMaxSpeed = 8.0
|
WallHugDownwardMaxSpeed = 4.0
|
||||||
WallHugHorizontalDeceleration = 0.5
|
WallHugHorizontalDeceleration = 1.0
|
||||||
|
|
||||||
|
[node name="CDamageable" type="Node" parent="."]
|
||||||
|
script = ExtResource("4_q7bng")
|
||||||
|
DamageModifiers = Array[Object]([SubResource("Resource_jb43f")])
|
||||||
|
metadata/_custom_type_script = "uid://b0u23nkpaimyc"
|
||||||
|
|
||||||
[node name="WallRunSnapper" type="RayCast3D" parent="."]
|
[node name="WallRunSnapper" type="RayCast3D" parent="."]
|
||||||
unique_name_in_owner = true
|
unique_name_in_owner = true
|
||||||
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
|
transform = Transform3D(0.99999994, 0, 0, 0, 1, 0, 0, 0, 0.99999994, 0, 0, 0)
|
||||||
target_position = Vector3(0, 0, -5)
|
target_position = Vector3(0, 0, -5)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="InputController" type="Node3D" parent="."]
|
[node name="InputController" type="Node3D" parent="."]
|
||||||
script = ExtResource("16_v31n3")
|
script = ExtResource("16_v31n3")
|
||||||
@@ -128,32 +158,50 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
|||||||
visible = false
|
visible = false
|
||||||
mesh = SubResource("CapsuleMesh_xc2g5")
|
mesh = SubResource("CapsuleMesh_xc2g5")
|
||||||
|
|
||||||
[node name="CapsuleCollider" type="CollisionShape3D" parent="."]
|
[node name="StandingCollider" type="CollisionShape3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.85, 0)
|
||||||
shape = ExtResource("13_r7i3q")
|
shape = ExtResource("13_r7i3q")
|
||||||
debug_color = Color(0, 0.6, 0.701961, 0.341176)
|
debug_color = Color(0, 0.6, 0.701961, 0.341176)
|
||||||
script = ExtResource("8_lmtjd")
|
|
||||||
CapsuleDefaultHeight = 1.7
|
[node name="SlideCollider" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.45, 0)
|
||||||
|
shape = SubResource("SphereShape3D_6lejt")
|
||||||
|
disabled = true
|
||||||
|
debug_color = Color(0, 0.6, 0.701961, 0.341176)
|
||||||
|
|
||||||
[node name="HeadSystem" parent="." instance=ExtResource("11_rxwoh")]
|
[node name="HeadSystem" parent="." instance=ExtResource("11_rxwoh")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
|
||||||
CameraInclineAcceleration = 20.0
|
CameraInclineAcceleration = 20.0
|
||||||
GroundedCameraIncline = 3.0
|
GroundedCameraIncline = 3.0
|
||||||
|
SlidingJitterAmplitude = 0.2
|
||||||
|
|
||||||
[node name="MantleSystem" parent="HeadSystem" instance=ExtResource("8_qu4wy")]
|
[node name="MantleSystem" parent="HeadSystem" instance=ExtResource("8_qu4wy")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
|
||||||
MantleEndLocationDistanceFromWall = 0.3
|
MantleEndLocationDistanceFromWall = 0.3
|
||||||
MantleHeightCastStart = 2.5
|
MantleHeightCastStart = 2.5
|
||||||
|
|
||||||
|
[node name="WeaponHitbox" type="Area3D" parent="HeadSystem"]
|
||||||
|
unique_name_in_owner = true
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, -1.6, 0)
|
||||||
|
collision_layer = 0
|
||||||
|
collision_mask = 16
|
||||||
|
monitorable = false
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="HeadSystem/WeaponHitbox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -1.5)
|
||||||
|
shape = SubResource("SphereShape3D_q14ux")
|
||||||
|
|
||||||
[node name="StairsSystem" type="Node3D" parent="."]
|
[node name="StairsSystem" type="Node3D" parent="."]
|
||||||
script = ExtResource("7_bmt5a")
|
script = ExtResource("7_bmt5a")
|
||||||
|
|
||||||
[node name="StairsAheadRayCast3D" type="RayCast3D" parent="."]
|
[node name="StairsAheadRayCast3D" type="RayCast3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -0.828)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.5, -0.828)
|
||||||
target_position = Vector3(0, -0.55, 0)
|
target_position = Vector3(0, -0.55, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="StairsBelowRayCast3D" type="RayCast3D" parent="."]
|
[node name="StairsBelowRayCast3D" type="RayCast3D" parent="."]
|
||||||
target_position = Vector3(0, -0.75, 0)
|
target_position = Vector3(0, -0.75, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="Bobbing" type="Node3D" parent="."]
|
[node name="Bobbing" type="Node3D" parent="."]
|
||||||
script = ExtResource("10_7wk1w")
|
script = ExtResource("10_7wk1w")
|
||||||
@@ -167,18 +215,22 @@ visible = false
|
|||||||
[node name="HeadCollisionDetector0" type="RayCast3D" parent="HeadCollisionDetectors"]
|
[node name="HeadCollisionDetector0" type="RayCast3D" parent="HeadCollisionDetectors"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, -0.210707)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, -0.210707)
|
||||||
target_position = Vector3(0, 1, 0)
|
target_position = Vector3(0, 1, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="HeadCollisionDetector1" type="RayCast3D" parent="HeadCollisionDetectors"]
|
[node name="HeadCollisionDetector1" type="RayCast3D" parent="HeadCollisionDetectors"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0.23061)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.4, 0.23061)
|
||||||
target_position = Vector3(0, 1, 0)
|
target_position = Vector3(0, 1, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="HeadCollisionDetector2" type="RayCast3D" parent="HeadCollisionDetectors"]
|
[node name="HeadCollisionDetector2" type="RayCast3D" parent="HeadCollisionDetectors"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.296, 1.4, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.296, 1.4, 0)
|
||||||
target_position = Vector3(0, 1, 0)
|
target_position = Vector3(0, 1, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="HeadCollisionDetector3" type="RayCast3D" parent="HeadCollisionDetectors"]
|
[node name="HeadCollisionDetector3" type="RayCast3D" parent="HeadCollisionDetectors"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.296, 1.4, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.296, 1.4, 0)
|
||||||
target_position = Vector3(0, 1, 0)
|
target_position = Vector3(0, 1, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="TweenQueueSystem" parent="." instance=ExtResource("22_rpwev")]
|
[node name="TweenQueueSystem" parent="." instance=ExtResource("22_rpwev")]
|
||||||
|
|
||||||
@@ -187,39 +239,39 @@ script = ExtResource("27_n7qhm")
|
|||||||
|
|
||||||
[node name="back" type="RayCast3D" parent="WallHugSystem"]
|
[node name="back" type="RayCast3D" parent="WallHugSystem"]
|
||||||
target_position = Vector3(0, 0, 1)
|
target_position = Vector3(0, 0, 1)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="back2" type="RayCast3D" parent="WallHugSystem"]
|
[node name="back2" type="RayCast3D" parent="WallHugSystem"]
|
||||||
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
||||||
target_position = Vector3(0, 0, 1)
|
target_position = Vector3(0, 0, 1)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="front" type="RayCast3D" parent="WallHugSystem"]
|
[node name="front" type="RayCast3D" parent="WallHugSystem"]
|
||||||
target_position = Vector3(0, 0, -1)
|
target_position = Vector3(0, 0, -1)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="front2" type="RayCast3D" parent="WallHugSystem"]
|
[node name="front2" type="RayCast3D" parent="WallHugSystem"]
|
||||||
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
||||||
target_position = Vector3(0, 0, -1)
|
target_position = Vector3(0, 0, -1)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="right" type="RayCast3D" parent="WallHugSystem"]
|
[node name="right" type="RayCast3D" parent="WallHugSystem"]
|
||||||
target_position = Vector3(1, 0, 0)
|
target_position = Vector3(1, 0, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="right2" type="RayCast3D" parent="WallHugSystem"]
|
[node name="right2" type="RayCast3D" parent="WallHugSystem"]
|
||||||
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
||||||
target_position = Vector3(1, 0, 0)
|
target_position = Vector3(1, 0, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="left" type="RayCast3D" parent="WallHugSystem"]
|
[node name="left" type="RayCast3D" parent="WallHugSystem"]
|
||||||
target_position = Vector3(-1, 0, 0)
|
target_position = Vector3(-1, 0, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="left2" type="RayCast3D" parent="WallHugSystem"]
|
[node name="left2" type="RayCast3D" parent="WallHugSystem"]
|
||||||
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
transform = Transform3D(0.70710677, 0, 0.70710677, 0, 1, 0, -0.70710677, 0, 0.70710677, 0, 0, 0)
|
||||||
target_position = Vector3(-1, 0, 0)
|
target_position = Vector3(-1, 0, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="DashSystem" parent="." instance=ExtResource("18_q5h8a")]
|
[node name="DashSystem" parent="." instance=ExtResource("18_q5h8a")]
|
||||||
DashSpeed = 0.2
|
DashSpeed = 0.2
|
||||||
@@ -241,8 +293,18 @@ mesh = SubResource("CylinderMesh_nodcl")
|
|||||||
|
|
||||||
[node name="GroundDetector" type="ShapeCast3D" parent="."]
|
[node name="GroundDetector" type="ShapeCast3D" parent="."]
|
||||||
shape = SubResource("CapsuleShape3D_6lejt")
|
shape = SubResource("CapsuleShape3D_6lejt")
|
||||||
target_position = Vector3(0, -0.5, 0)
|
collision_mask = 256
|
||||||
collision_mask = 2
|
|
||||||
|
[node name="CeilingDetector" type="ShapeCast3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.9, 0)
|
||||||
|
enabled = false
|
||||||
|
shape = SubResource("SphereShape3D_nob5r")
|
||||||
|
target_position = Vector3(0, 0.4, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
|
[node name="DirectGroundDetector" type="RayCast3D" parent="."]
|
||||||
|
target_position = Vector3(0, -2, 0)
|
||||||
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="DashCooldown" type="Timer" parent="."]
|
[node name="DashCooldown" type="Timer" parent="."]
|
||||||
wait_time = 0.8
|
wait_time = 0.8
|
||||||
@@ -266,6 +328,7 @@ offset_left = 1524.0
|
|||||||
offset_top = 1.0
|
offset_top = 1.0
|
||||||
offset_right = -8.0
|
offset_right = -8.0
|
||||||
offset_bottom = 1.0
|
offset_bottom = 1.0
|
||||||
|
enabled = false
|
||||||
initial_node_to_watch = NodePath("../StateChart")
|
initial_node_to_watch = NodePath("../StateChart")
|
||||||
|
|
||||||
[node name="UI" type="Control" parent="."]
|
[node name="UI" type="Control" parent="."]
|
||||||
@@ -526,14 +589,23 @@ to = NodePath("../../OnWall/Hugging")
|
|||||||
event = &"on_wall"
|
event = &"on_wall"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="Slamming" type="Node" parent="StateChart/Root/Movement"]
|
||||||
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
|
[node name="OnSlamEnded" type="Node" parent="StateChart/Root/Movement/Slamming"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../Grounded")
|
||||||
|
event = &"grounded"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Jump" type="Node" parent="StateChart/Root/Movement"]
|
[node name="Jump" type="Node" parent="StateChart/Root/Movement"]
|
||||||
script = ExtResource("26_infe6")
|
script = ExtResource("26_infe6")
|
||||||
initial_state = NodePath("SimpleJump")
|
initial_state = NodePath("SimpleJump")
|
||||||
|
|
||||||
[node name="OnSlide" type="Node" parent="StateChart/Root/Movement/Jump"]
|
[node name="OnDash" type="Node" parent="StateChart/Root/Movement/Jump"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../Sliding/AirGlide")
|
to = NodePath("../../Dashing/Dash")
|
||||||
event = &"slide"
|
event = &"dash"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnMantle" type="Node" parent="StateChart/Root/Movement/Jump"]
|
[node name="OnMantle" type="Node" parent="StateChart/Root/Movement/Jump"]
|
||||||
@@ -551,6 +623,12 @@ to = NodePath("../../../Airborne/DoubleJumpEnabled")
|
|||||||
event = &"jump_ended"
|
event = &"jump_ended"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnSlide" type="Node" parent="StateChart/Root/Movement/Jump/SimpleJump"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Sliding/AirGlideDoubleJumpEnabled")
|
||||||
|
event = &"slide"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="DoubleJump" type="Node" parent="StateChart/Root/Movement/Jump"]
|
[node name="DoubleJump" type="Node" parent="StateChart/Root/Movement/Jump"]
|
||||||
script = ExtResource("27_34snm")
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
@@ -560,10 +638,22 @@ to = NodePath("../../../Airborne/Falling")
|
|||||||
event = &"jump_ended"
|
event = &"jump_ended"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnSlide" type="Node" parent="StateChart/Root/Movement/Jump/DoubleJump"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Sliding/AirGlide")
|
||||||
|
event = &"slide"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Dashing" type="Node" parent="StateChart/Root/Movement"]
|
[node name="Dashing" type="Node" parent="StateChart/Root/Movement"]
|
||||||
script = ExtResource("26_infe6")
|
script = ExtResource("26_infe6")
|
||||||
initial_state = NodePath("Dash")
|
initial_state = NodePath("Dash")
|
||||||
|
|
||||||
|
[node name="OnDashEndedGrounded" type="Node" parent="StateChart/Root/Movement/Dashing"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../Grounded")
|
||||||
|
event = &"grounded"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnDashEnded" type="Node" parent="StateChart/Root/Movement/Dashing"]
|
[node name="OnDashEnded" type="Node" parent="StateChart/Root/Movement/Dashing"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../Airborne/Reset")
|
to = NodePath("../../Airborne/Reset")
|
||||||
@@ -592,6 +682,12 @@ script = ExtResource("27_34snm")
|
|||||||
script = ExtResource("26_infe6")
|
script = ExtResource("26_infe6")
|
||||||
initial_state = NodePath("GroundSlide")
|
initial_state = NodePath("GroundSlide")
|
||||||
|
|
||||||
|
[node name="OnDash" type="Node" parent="StateChart/Root/Movement/Sliding"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../Dashing/Dash")
|
||||||
|
event = &"actually_no_dash"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnMantle" type="Node" parent="StateChart/Root/Movement/Sliding"]
|
[node name="OnMantle" type="Node" parent="StateChart/Root/Movement/Sliding"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../Mantling")
|
to = NodePath("../../Mantling")
|
||||||
@@ -609,10 +705,43 @@ delay_in_seconds = "0.0"
|
|||||||
|
|
||||||
[node name="OnAirborne" type="Node" parent="StateChart/Root/Movement/Sliding/GroundSlide"]
|
[node name="OnAirborne" type="Node" parent="StateChart/Root/Movement/Sliding/GroundSlide"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../AirGlide")
|
to = NodePath("../../AirGlideDoubleJumpEnabled")
|
||||||
event = &"start_falling"
|
event = &"start_falling"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Sliding/GroundSlide"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Jump/SimpleJump")
|
||||||
|
event = &"jump"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnCancel" type="Node" parent="StateChart/Root/Movement/Sliding/GroundSlide"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../SlideCanceled")
|
||||||
|
event = &"slide_canceled"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="AirGlideDoubleJumpEnabled" type="Node" parent="StateChart/Root/Movement/Sliding"]
|
||||||
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
|
[node name="OnSlideReleased" type="Node" parent="StateChart/Root/Movement/Sliding/AirGlideDoubleJumpEnabled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Airborne/Reset")
|
||||||
|
event = &"slide_released"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnGrounded" type="Node" parent="StateChart/Root/Movement/Sliding/AirGlideDoubleJumpEnabled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../GroundSlide")
|
||||||
|
event = &"grounded"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Sliding/AirGlideDoubleJumpEnabled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Jump/DoubleJump")
|
||||||
|
event = &"jump"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="AirGlide" type="Node" parent="StateChart/Root/Movement/Sliding"]
|
[node name="AirGlide" type="Node" parent="StateChart/Root/Movement/Sliding"]
|
||||||
script = ExtResource("27_34snm")
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
@@ -628,6 +757,33 @@ to = NodePath("../../GroundSlide")
|
|||||||
event = &"grounded"
|
event = &"grounded"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="SlideCanceled" type="Node" parent="StateChart/Root/Movement/Sliding"]
|
||||||
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
|
[node name="OnAirborne" type="Node" parent="StateChart/Root/Movement/Sliding/SlideCanceled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Airborne/CoyoteEnabled")
|
||||||
|
event = &"start_falling"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnDash" type="Node" parent="StateChart/Root/Movement/Sliding/SlideCanceled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Dashing/Dash")
|
||||||
|
event = &"dash"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Sliding/SlideCanceled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Jump/SimpleJump")
|
||||||
|
event = &"jump"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnSlideReleased" type="Node" parent="StateChart/Root/Movement/Sliding/SlideCanceled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Grounded")
|
||||||
|
event = &"slide_released"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="Airborne" type="Node" parent="StateChart/Root/Movement"]
|
[node name="Airborne" type="Node" parent="StateChart/Root/Movement"]
|
||||||
script = ExtResource("26_infe6")
|
script = ExtResource("26_infe6")
|
||||||
initial_state = NodePath("CoyoteEnabled")
|
initial_state = NodePath("CoyoteEnabled")
|
||||||
@@ -654,15 +810,21 @@ to = NodePath("../../Grounded")
|
|||||||
event = &"grounded"
|
event = &"grounded"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnSlide" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
[node name="OnSlam" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../Sliding/AirGlide")
|
to = NodePath("../../Slamming")
|
||||||
event = &"slide"
|
event = &"slam"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="CoyoteEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
[node name="CoyoteEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
script = ExtResource("27_34snm")
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
|
[node name="OnSlide" type="Node" parent="StateChart/Root/Movement/Airborne/CoyoteEnabled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Sliding/AirGlideDoubleJumpEnabled")
|
||||||
|
event = &"slide"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Airborne/CoyoteEnabled"]
|
[node name="OnJump" type="Node" parent="StateChart/Root/Movement/Airborne/CoyoteEnabled"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../Jump/SimpleJump")
|
to = NodePath("../../../Jump/SimpleJump")
|
||||||
@@ -678,6 +840,12 @@ delay_in_seconds = "0.0"
|
|||||||
[node name="DoubleJumpEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
[node name="DoubleJumpEnabled" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
script = ExtResource("27_34snm")
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
|
[node name="OnSlide" type="Node" parent="StateChart/Root/Movement/Airborne/DoubleJumpEnabled"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Sliding/AirGlideDoubleJumpEnabled")
|
||||||
|
event = &"slide"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/DoubleJumpEnabled"]
|
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/DoubleJumpEnabled"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../OnWall/Hugging")
|
to = NodePath("../../../OnWall/Hugging")
|
||||||
@@ -693,6 +861,12 @@ delay_in_seconds = "0.0"
|
|||||||
[node name="Falling" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
[node name="Falling" type="Node" parent="StateChart/Root/Movement/Airborne"]
|
||||||
script = ExtResource("27_34snm")
|
script = ExtResource("27_34snm")
|
||||||
|
|
||||||
|
[node name="OnSlide" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Sliding/AirGlide")
|
||||||
|
event = &"slide"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
[node name="OnWallHug" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
script = ExtResource("28_n7qhm")
|
script = ExtResource("28_n7qhm")
|
||||||
to = NodePath("../../../OnWall/Hugging")
|
to = NodePath("../../../OnWall/Hugging")
|
||||||
@@ -705,6 +879,12 @@ to = NodePath("../../DoubleJumpEnabled")
|
|||||||
event = &"enable_double_jump"
|
event = &"enable_double_jump"
|
||||||
delay_in_seconds = "0.0"
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
|
[node name="OnWallJump" type="Node" parent="StateChart/Root/Movement/Airborne/Falling"]
|
||||||
|
script = ExtResource("28_n7qhm")
|
||||||
|
to = NodePath("../../../Jump/DoubleJump")
|
||||||
|
event = &"wall_jump"
|
||||||
|
delay_in_seconds = "0.0"
|
||||||
|
|
||||||
[node name="OnWall" type="Node" parent="StateChart/Root/Movement"]
|
[node name="OnWall" type="Node" parent="StateChart/Root/Movement"]
|
||||||
script = ExtResource("26_infe6")
|
script = ExtResource("26_infe6")
|
||||||
initial_state = NodePath("Hugging")
|
initial_state = NodePath("Hugging")
|
||||||
|
|||||||
@@ -40,17 +40,13 @@ public partial class CapsuleCollider : CollisionShape3D
|
|||||||
return Mathf.IsEqualApprox(_shape.Height, CapsuleCrouchHeight);
|
return Mathf.IsEqualApprox(_shape.Height, CapsuleCrouchHeight);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Crouch(float delta, float crouchTransitionSpeed)
|
public void Crouch()
|
||||||
{
|
{
|
||||||
_shape.Height -= delta * crouchTransitionSpeed;
|
_shape.Height = CapsuleCrouchHeight;
|
||||||
|
|
||||||
_shape.Height = Mathf.Clamp(_shape.Height, CapsuleCrouchHeight, CapsuleDefaultHeight);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void UndoCrouching(float delta, float crouchTransitionSpeed)
|
public void Uncrouch()
|
||||||
{
|
{
|
||||||
_shape.Height += delta * crouchTransitionSpeed;
|
_shape.Height = CapsuleDefaultHeight;
|
||||||
|
|
||||||
_shape.Height = Mathf.Clamp(_shape.Height, CapsuleCrouchHeight, CapsuleDefaultHeight);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,11 +2,14 @@ using System;
|
|||||||
using Godot;
|
using Godot;
|
||||||
using GodotStateCharts;
|
using GodotStateCharts;
|
||||||
using Movementtests.addons.godot_state_charts.csharp;
|
using Movementtests.addons.godot_state_charts.csharp;
|
||||||
|
using Movementtests.interfaces;
|
||||||
using Movementtests.systems;
|
using Movementtests.systems;
|
||||||
using Movementtests.player_controller.Scripts;
|
using Movementtests.player_controller.Scripts;
|
||||||
using RustyOptions;
|
using RustyOptions;
|
||||||
|
|
||||||
public partial class PlayerController : CharacterBody3D
|
public partial class PlayerController : CharacterBody3D,
|
||||||
|
IDamageable,
|
||||||
|
IDamageDealer
|
||||||
{
|
{
|
||||||
// Enums
|
// Enums
|
||||||
public enum AllowedInputs
|
public enum AllowedInputs
|
||||||
@@ -28,6 +31,12 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
}
|
}
|
||||||
private BufferedActions _bufferedAction = BufferedActions.None;
|
private BufferedActions _bufferedAction = BufferedActions.None;
|
||||||
|
|
||||||
|
///////////////////////////
|
||||||
|
// Signals and events //
|
||||||
|
///////////////////////////
|
||||||
|
|
||||||
|
public event Action<IDamageable, DamageRecord> DamageTaken;
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Public stuff //
|
// Public stuff //
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -37,7 +46,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public StairsSystem StairsSystem;
|
public StairsSystem StairsSystem;
|
||||||
public MantleSystem MantleSystem;
|
public MantleSystem MantleSystem;
|
||||||
public DashSystem DashSystem;
|
public DashSystem DashSystem;
|
||||||
public CapsuleCollider CapsuleCollider;
|
public CollisionShape3D StandingCollider;
|
||||||
|
public CollisionShape3D SlideCollider;
|
||||||
public Node3D WeaponRoot;
|
public Node3D WeaponRoot;
|
||||||
public WeaponSystem WeaponSystem;
|
public WeaponSystem WeaponSystem;
|
||||||
public WallHugSystem WallHugSystem;
|
public WallHugSystem WallHugSystem;
|
||||||
@@ -49,11 +59,21 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public CylinderMesh DashIndicatorMeshCylinder;
|
public CylinderMesh DashIndicatorMeshCylinder;
|
||||||
public RayCast3D WallRunSnapper;
|
public RayCast3D WallRunSnapper;
|
||||||
public ShapeCast3D GroundDetector;
|
public ShapeCast3D GroundDetector;
|
||||||
|
public ShapeCast3D CeilingDetector;
|
||||||
|
public RayCast3D DirectGroundDetector;
|
||||||
|
public Area3D WeaponHitbox;
|
||||||
|
|
||||||
// Inspector stuff
|
// Inspector stuff
|
||||||
[Export] public Marker3D TutorialWeaponTarget;
|
[Export] public Marker3D TutorialWeaponTarget;
|
||||||
[Export] public bool TutorialDone { get; set; }
|
[Export] public bool TutorialDone { get; set; }
|
||||||
|
|
||||||
|
[ExportCategory("Combat")]
|
||||||
|
[ExportGroup("Damage")]
|
||||||
|
[Export]
|
||||||
|
public RDamage RDamage { get; set; }
|
||||||
|
[Export]
|
||||||
|
public CDamageable CDamage { get; set; }
|
||||||
|
|
||||||
[ExportCategory("Movement")]
|
[ExportCategory("Movement")]
|
||||||
[ExportGroup("Ground")]
|
[ExportGroup("Ground")]
|
||||||
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
||||||
@@ -118,8 +138,10 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public int MaxNumberOfEmpoweredActions { get; set; } = 1;
|
public int MaxNumberOfEmpoweredActions { get; set; } = 1;
|
||||||
// Simple dash
|
// Simple dash
|
||||||
[ExportSubgroup("Simple")]
|
[ExportSubgroup("Simple")]
|
||||||
[Export(PropertyHint.Range, "0,50,0.1")]
|
[Export(PropertyHint.Range, "0,50,0.1,or_greater")]
|
||||||
public float SimpleDashStrength { get; set; } = 10f;
|
public float SimpleDashStrength { get; set; } = 10f;
|
||||||
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
|
public float SimpleDashTime { get; set; } = 0.5f;
|
||||||
// Aimed Dash
|
// Aimed Dash
|
||||||
[ExportSubgroup("Special")]
|
[ExportSubgroup("Special")]
|
||||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
@@ -128,6 +150,10 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public float PostDashSpeed { get; set; } = 100f;
|
public float PostDashSpeed { get; set; } = 100f;
|
||||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
public float TimeScaleAimInAir { get; set; } = 0.05f;
|
public float TimeScaleAimInAir { get; set; } = 0.05f;
|
||||||
|
// Slam
|
||||||
|
[ExportSubgroup("Slam")]
|
||||||
|
[Export(PropertyHint.Range, "0,100,1,or_greater")]
|
||||||
|
public float SlamSpeed { get; set; } = 50.0f;
|
||||||
|
|
||||||
// Sliding and gliding
|
// Sliding and gliding
|
||||||
[ExportGroup("Slide")]
|
[ExportGroup("Slide")]
|
||||||
@@ -136,14 +162,36 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public float AccelerationGroundSlide = 1.0f;
|
public float AccelerationGroundSlide = 1.0f;
|
||||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
public float DecelerationGroundSlide = 0.1f;
|
public float DecelerationGroundSlide = 0.1f;
|
||||||
|
[Export(PropertyHint.Range, "0.99,1,0.0001")]
|
||||||
|
public float FlatGroundSlideSpeedLossRate = 0.9975f;
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float GroundSlideJumpMultiplier = 1.0f;
|
||||||
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
|
public float GroundSlideJumpSpeedFactor;
|
||||||
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
|
public float GroundSlideDownSlopeAcceleration = 0.1f;
|
||||||
|
[Export(PropertyHint.Range, "0,100,0.1,or_greater")]
|
||||||
|
public float GroundSlideDownSlopeMaxSpeed = 50f;
|
||||||
|
[Export(PropertyHint.Range, "1,10,0.1,or_greater")]
|
||||||
|
public float GroundSlideSlopeMagnetism = 2f;
|
||||||
|
|
||||||
|
|
||||||
[ExportSubgroup("Air glide")]
|
[ExportSubgroup("Air glide")]
|
||||||
|
[Export]
|
||||||
|
public bool AllowForVelocityRedirection = true;
|
||||||
|
|
||||||
[Export(PropertyHint.Range, "0,10,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,10,0.01,or_greater")]
|
||||||
public float AirGlideVSpeed { get; set; } = 1.0f;
|
public float AirGlideVSpeed { get; set; } = 1.0f;
|
||||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
public float AccelerationAirGlide = 1.0f;
|
public float AccelerationAirGlide = 1.0f;
|
||||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
public float DecelerationAirGlide = 0.1f;
|
public float DecelerationAirGlide = 0.1f;
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.01,or_greater")]
|
||||||
|
public float AirGlideVerticalAcceleration = 1.0f;
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float AirGlideJumpMultiplier = 1.0f;
|
||||||
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
|
public float AirGlideJumpSpeedFactor;
|
||||||
|
|
||||||
// Wall hug
|
// Wall hug
|
||||||
[ExportGroup("Wall hug")]
|
[ExportGroup("Wall hug")]
|
||||||
@@ -246,6 +294,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
private StateChartState _grounded;
|
private StateChartState _grounded;
|
||||||
private StateChartState _airborne;
|
private StateChartState _airborne;
|
||||||
private StateChartState _coyoteEnabled;
|
private StateChartState _coyoteEnabled;
|
||||||
|
private StateChartState _jumping;
|
||||||
private StateChartState _simpleJump;
|
private StateChartState _simpleJump;
|
||||||
private StateChartState _doubleJump;
|
private StateChartState _doubleJump;
|
||||||
private StateChartState _mantling;
|
private StateChartState _mantling;
|
||||||
@@ -254,13 +303,20 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
private StateChartState _sliding;
|
private StateChartState _sliding;
|
||||||
private StateChartState _groundSliding;
|
private StateChartState _groundSliding;
|
||||||
private StateChartState _airGliding;
|
private StateChartState _airGliding;
|
||||||
|
private StateChartState _airGlidingDoubleJump;
|
||||||
|
private StateChartState _slideCanceled;
|
||||||
|
private StateChartState _slamming;
|
||||||
private StateChartState _onWall;
|
private StateChartState _onWall;
|
||||||
private StateChartState _onWallHugging;
|
private StateChartState _onWallHugging;
|
||||||
private StateChartState _onWallHanging;
|
private StateChartState _onWallHanging;
|
||||||
private StateChartState _onWallRunning;
|
private StateChartState _onWallRunning;
|
||||||
|
|
||||||
private Transition _onJumpFromWall;
|
private Transition _onJumpFromWall;
|
||||||
|
private Transition _onJumpFromWallFalling;
|
||||||
private Transition _onLeaveWallFromRun;
|
private Transition _onLeaveWallFromRun;
|
||||||
|
|
||||||
|
private Transition _onGroundSlideJump;
|
||||||
|
private Transition _onAirGlideDoubleJump;
|
||||||
|
|
||||||
public override void _Ready()
|
public override void _Ready()
|
||||||
{
|
{
|
||||||
@@ -293,12 +349,15 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
WeaponRoot = GetNode<Node3D>("WeaponRoot");
|
WeaponRoot = GetNode<Node3D>("WeaponRoot");
|
||||||
WeaponSystem = GetNode<WeaponSystem>("WeaponRoot/WeaponSystem");
|
WeaponSystem = GetNode<WeaponSystem>("WeaponRoot/WeaponSystem");
|
||||||
MantleSystem = GetNode<MantleSystem>("HeadSystem/MantleSystem");
|
MantleSystem = GetNode<MantleSystem>("HeadSystem/MantleSystem");
|
||||||
CapsuleCollider = GetNode<CapsuleCollider>("CapsuleCollider");
|
StandingCollider = GetNode<CollisionShape3D>("StandingCollider");
|
||||||
|
SlideCollider = GetNode<CollisionShape3D>("SlideCollider");
|
||||||
DashSystem = GetNode<DashSystem>("DashSystem");
|
DashSystem = GetNode<DashSystem>("DashSystem");
|
||||||
StairsSystem = GetNode<StairsSystem>("StairsSystem");
|
StairsSystem = GetNode<StairsSystem>("StairsSystem");
|
||||||
WallHugSystem = GetNode<WallHugSystem>("WallHugSystem");
|
WallHugSystem = GetNode<WallHugSystem>("WallHugSystem");
|
||||||
WallRunSnapper = GetNode<RayCast3D>("%WallRunSnapper");
|
WallRunSnapper = GetNode<RayCast3D>("%WallRunSnapper");
|
||||||
GroundDetector = GetNode<ShapeCast3D>("GroundDetector");
|
GroundDetector = GetNode<ShapeCast3D>("GroundDetector");
|
||||||
|
CeilingDetector = GetNode<ShapeCast3D>("CeilingDetector");
|
||||||
|
DirectGroundDetector = GetNode<RayCast3D>("DirectGroundDetector");
|
||||||
RayCast3D stairsBelowRayCast3D = GetNode<RayCast3D>("StairsBelowRayCast3D");
|
RayCast3D stairsBelowRayCast3D = GetNode<RayCast3D>("StairsBelowRayCast3D");
|
||||||
RayCast3D stairsAheadRayCast3D = GetNode<RayCast3D>("StairsAheadRayCast3D");
|
RayCast3D stairsAheadRayCast3D = GetNode<RayCast3D>("StairsAheadRayCast3D");
|
||||||
_headCollisionDetectors = new RayCast3D[NUM_OF_HEAD_COLLISION_DETECTORS];
|
_headCollisionDetectors = new RayCast3D[NUM_OF_HEAD_COLLISION_DETECTORS];
|
||||||
@@ -308,9 +367,11 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
"HeadCollisionDetectors/HeadCollisionDetector" + i);
|
"HeadCollisionDetectors/HeadCollisionDetector" + i);
|
||||||
}
|
}
|
||||||
|
|
||||||
var playerShape = CapsuleCollider.GetShape() as CapsuleShape3D;
|
var playerShape = StandingCollider.GetShape() as CapsuleShape3D;
|
||||||
_playerHeight = playerShape!.Height;
|
_playerHeight = playerShape!.Height;
|
||||||
_playerRadius = playerShape.Radius;
|
_playerRadius = playerShape.Radius;
|
||||||
|
|
||||||
|
WeaponHitbox = GetNode<Area3D>("%WeaponHitbox");
|
||||||
|
|
||||||
// State management
|
// State management
|
||||||
_playerState = StateChart.Of(GetNode("StateChart"));
|
_playerState = StateChart.Of(GetNode("StateChart"));
|
||||||
@@ -318,10 +379,15 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On"));
|
_aiming = StateChartState.Of(GetNode("StateChart/Root/Aim/On"));
|
||||||
_simpleDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/Dash"));
|
_simpleDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/Dash"));
|
||||||
_aimedDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/AimedDash"));
|
_aimedDash = StateChartState.Of(GetNode("StateChart/Root/Movement/Dashing/AimedDash"));
|
||||||
|
_slamming = StateChartState.Of(GetNode("StateChart/Root/Movement/Slamming"));
|
||||||
|
|
||||||
_sliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding"));
|
_sliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding"));
|
||||||
|
_slideCanceled = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/SlideCanceled"));
|
||||||
_groundSliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/GroundSlide"));
|
_groundSliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/GroundSlide"));
|
||||||
_airGliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/AirGlide"));
|
_airGliding = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/AirGlide"));
|
||||||
|
_airGlidingDoubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Sliding/AirGlideDoubleJumpEnabled"));
|
||||||
|
_onGroundSlideJump = Transition.Of(GetNode("StateChart/Root/Movement/Sliding/GroundSlide/OnJump"));
|
||||||
|
_onAirGlideDoubleJump = Transition.Of(GetNode("StateChart/Root/Movement/Sliding/AirGlideDoubleJumpEnabled/OnJump"));
|
||||||
|
|
||||||
// _actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
// _actionHanging = StateChartState.Of(GetNode("StateChart/Root/Actions/Hanging"));
|
||||||
_powerExpired = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Expired"));
|
_powerExpired = StateChartState.Of(GetNode("StateChart/Root/PowerReserve/Expired"));
|
||||||
@@ -332,10 +398,12 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_airborne = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne"));
|
_airborne = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne"));
|
||||||
_coyoteEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/CoyoteEnabled"));
|
_coyoteEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/CoyoteEnabled"));
|
||||||
// _doubleJumpEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/DoubleJumpEnabled"));
|
// _doubleJumpEnabled = StateChartState.Of(GetNode("StateChart/Root/Movement/Airborne/DoubleJumpEnabled"));
|
||||||
|
_jumping = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump"));
|
||||||
_simpleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/SimpleJump"));
|
_simpleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/SimpleJump"));
|
||||||
_doubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/DoubleJump"));
|
_doubleJump = StateChartState.Of(GetNode("StateChart/Root/Movement/Jump/DoubleJump"));
|
||||||
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
_mantling = StateChartState.Of(GetNode("StateChart/Root/Movement/Mantling"));
|
||||||
_onJumpFromWall = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/OnJump"));
|
_onJumpFromWall = Transition.Of(GetNode("StateChart/Root/Movement/OnWall/OnJump"));
|
||||||
|
_onJumpFromWallFalling = Transition.Of(GetNode("StateChart/Root/Movement/Airborne/Falling/OnWallJump"));
|
||||||
_onWall = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall"));
|
_onWall = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall"));
|
||||||
_onWallHugging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging"));
|
_onWallHugging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hugging"));
|
||||||
_onWallHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging"));
|
_onWallHanging = StateChartState.Of(GetNode("StateChart/Root/Movement/OnWall/Hanging"));
|
||||||
@@ -411,8 +479,18 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
_sliding.StateEntered += SlideStarted;
|
_sliding.StateEntered += SlideStarted;
|
||||||
_sliding.StateExited += SlideEnded;
|
_sliding.StateExited += SlideEnded;
|
||||||
|
_slideCanceled.StateEntered += OnSlideCanceled;
|
||||||
|
_slideCanceled.StatePhysicsProcessing += HandleSlideCanceled;
|
||||||
_groundSliding.StatePhysicsProcessing += HandleGroundSlide;
|
_groundSliding.StatePhysicsProcessing += HandleGroundSlide;
|
||||||
_airGliding.StatePhysicsProcessing += HandleAirGlide;
|
_airGliding.StatePhysicsProcessing += HandleAirGlide;
|
||||||
|
_airGlidingDoubleJump.StatePhysicsProcessing += HandleAirGlide;
|
||||||
|
|
||||||
|
_onGroundSlideJump.Taken += JumpFromGroundSlide;
|
||||||
|
_onAirGlideDoubleJump.Taken += JumpFromAirGlide;
|
||||||
|
|
||||||
|
_slamming.StateEntered += SlamStarted;
|
||||||
|
_slamming.StateExited += SlamEnded;
|
||||||
|
_slamming.StatePhysicsProcessing += HandleSlam;
|
||||||
|
|
||||||
_simpleDashCooldownTimer.Timeout += DashCooldownTimeout;
|
_simpleDashCooldownTimer.Timeout += DashCooldownTimeout;
|
||||||
_airborneDashCooldownTimer.Timeout += AirborneDashCooldownTimeout;
|
_airborneDashCooldownTimer.Timeout += AirborneDashCooldownTimeout;
|
||||||
@@ -424,6 +502,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_onWallRunning.StatePhysicsProcessing += HandleWallRunning;
|
_onWallRunning.StatePhysicsProcessing += HandleWallRunning;
|
||||||
|
|
||||||
_onJumpFromWall.Taken += OnJumpFromWall;
|
_onJumpFromWall.Taken += OnJumpFromWall;
|
||||||
|
_onJumpFromWallFalling.Taken += OnJumpFromWall;
|
||||||
_onLeaveWallFromRun.Taken += OnLeaveWallFromRun;
|
_onLeaveWallFromRun.Taken += OnLeaveWallFromRun;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,6 +557,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Grounded management //
|
// Grounded management //
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
|
|
||||||
public void OnGrounded()
|
public void OnGrounded()
|
||||||
{
|
{
|
||||||
_isWallJumpAvailable = true;
|
_isWallJumpAvailable = true;
|
||||||
@@ -486,28 +566,36 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
if (_simpleDashCooldownTimer.IsStopped())
|
if (_simpleDashCooldownTimer.IsStopped())
|
||||||
_simpleDashCooldownTimer.Start();
|
_simpleDashCooldownTimer.Start();
|
||||||
|
|
||||||
if (_bufferedAction == BufferedActions.Jump && _currentInputBufferFrames > 0)
|
|
||||||
{
|
|
||||||
_currentInputBufferFrames = 0;
|
|
||||||
PerformJump();
|
|
||||||
}
|
|
||||||
if (_bufferedAction == BufferedActions.Dash && _currentInputBufferFrames > 0)
|
|
||||||
{
|
|
||||||
_currentInputBufferFrames = 0;
|
|
||||||
SimpleDash();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (_bufferedAction == BufferedActions.MantleJump)
|
if (_bufferedAction == BufferedActions.MantleJump)
|
||||||
{
|
{
|
||||||
SimpleDash();
|
_playerState.SendEvent("jump");
|
||||||
OnJumpStarted(MantleJumpStartVelocity);
|
|
||||||
}
|
}
|
||||||
if (_bufferedAction == BufferedActions.MantleDash)
|
if (_bufferedAction == BufferedActions.MantleDash)
|
||||||
{
|
{
|
||||||
SimpleDash(MantleDashStrength);
|
if (GetMoveInput().Length() < Mathf.Epsilon)
|
||||||
|
{
|
||||||
|
_bufferedAction = BufferedActions.None;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_playerState.SendEvent("dash");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_bufferedAction == BufferedActions.Jump && _currentInputBufferFrames > 0)
|
||||||
|
{
|
||||||
|
_currentInputBufferFrames = 0;
|
||||||
|
_playerState.SendEvent("jump");
|
||||||
|
}
|
||||||
|
if (_bufferedAction == BufferedActions.Dash && _currentInputBufferFrames > 0)
|
||||||
|
{
|
||||||
|
if (GetMoveInput().Length() < Mathf.Epsilon)
|
||||||
|
{
|
||||||
|
_bufferedAction = BufferedActions.None;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
_currentInputBufferFrames = 0;
|
||||||
|
_playerState.SendEvent("dash");
|
||||||
}
|
}
|
||||||
|
|
||||||
_bufferedAction = BufferedActions.None;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsGroundLike()
|
public bool IsGroundLike()
|
||||||
@@ -528,14 +616,14 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
Velocity = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z);
|
Velocity = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void HandleStairs(float delta)
|
private void MoveSlideAndHandleStairs(float delta)
|
||||||
{
|
{
|
||||||
StairsSystem.UpStairsCheckParams upStairsCheckParams = new StairsSystem.UpStairsCheckParams
|
StairsSystem.UpStairsCheckParams upStairsCheckParams = new StairsSystem.UpStairsCheckParams
|
||||||
{
|
{
|
||||||
IsOnFloorCustom = isOnFloorCustom(),
|
IsOnFloorCustom = isOnFloorCustom(),
|
||||||
IsCapsuleHeightLessThanNormal = CapsuleCollider.IsCapsuleHeightLessThanNormal(),
|
IsCapsuleHeightLessThanNormal = false,
|
||||||
CurrentSpeedGreaterThanWalkSpeed = false,
|
CurrentSpeedGreaterThanWalkSpeed = false,
|
||||||
IsCrouchingHeight = CapsuleCollider.IsCrouchingHeight(),
|
IsCrouchingHeight = false,
|
||||||
Delta = delta,
|
Delta = delta,
|
||||||
FloorMaxAngle = FloorMaxAngle,
|
FloorMaxAngle = FloorMaxAngle,
|
||||||
GlobalPositionFromDriver = GlobalPosition,
|
GlobalPositionFromDriver = GlobalPosition,
|
||||||
@@ -545,7 +633,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
};
|
};
|
||||||
StairsSystem.UpStairsCheckResult upStairsCheckResult = StairsSystem.SnapUpStairsCheck(upStairsCheckParams);
|
StairsSystem.UpStairsCheckResult upStairsCheckResult = StairsSystem.SnapUpStairsCheck(upStairsCheckParams);
|
||||||
|
|
||||||
if (upStairsCheckResult.UpdateRequired)
|
if (upStairsCheckResult.UpdateRequired && !_jumping.Active)
|
||||||
{
|
{
|
||||||
upStairsCheckResult.Update(this);
|
upStairsCheckResult.Update(this);
|
||||||
}
|
}
|
||||||
@@ -556,10 +644,10 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
StairsSystem.DownStairsCheckParams downStairsCheckParams = new StairsSystem.DownStairsCheckParams
|
StairsSystem.DownStairsCheckParams downStairsCheckParams = new StairsSystem.DownStairsCheckParams
|
||||||
{
|
{
|
||||||
IsOnFloor = IsOnFloor(),
|
IsOnFloor = IsOnFloor(),
|
||||||
IsCrouchingHeight = CapsuleCollider.IsCrouchingHeight(),
|
IsCrouchingHeight = false,
|
||||||
LastFrameWasOnFloor = _lastFrameWasOnFloor,
|
LastFrameWasOnFloor = _lastFrameWasOnFloor,
|
||||||
CapsuleDefaultHeight = CapsuleCollider.GetDefaultHeight(),
|
CapsuleDefaultHeight = _playerHeight,
|
||||||
CurrentCapsuleHeight = CapsuleCollider.GetCurrentHeight(),
|
CurrentCapsuleHeight = _playerHeight,
|
||||||
FloorMaxAngle = FloorMaxAngle,
|
FloorMaxAngle = FloorMaxAngle,
|
||||||
VelocityY = Velocity.Y,
|
VelocityY = Velocity.Y,
|
||||||
GlobalTransformFromDriver = GlobalTransform,
|
GlobalTransformFromDriver = GlobalTransform,
|
||||||
@@ -577,9 +665,9 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
StairsSystem.SlideCameraParams slideCameraParams = new StairsSystem.SlideCameraParams
|
StairsSystem.SlideCameraParams slideCameraParams = new StairsSystem.SlideCameraParams
|
||||||
{
|
{
|
||||||
IsCapsuleHeightLessThanNormal = CapsuleCollider.IsCapsuleHeightLessThanNormal(),
|
IsCapsuleHeightLessThanNormal = false,
|
||||||
CurrentSpeedGreaterThanWalkSpeed = false,
|
CurrentSpeedGreaterThanWalkSpeed = false,
|
||||||
BetweenCrouchingAndNormalHeight = CapsuleCollider.IsBetweenCrouchingAndNormalHeight(),
|
BetweenCrouchingAndNormalHeight = false,
|
||||||
Delta = delta
|
Delta = delta
|
||||||
};
|
};
|
||||||
StairsSystem.SlideCameraSmoothBackToOrigin(slideCameraParams);
|
StairsSystem.SlideCameraSmoothBackToOrigin(slideCameraParams);
|
||||||
@@ -638,7 +726,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
}
|
}
|
||||||
|
|
||||||
// If all else fail and we go down, we hug
|
// If all else fail and we go down, we hug
|
||||||
if (Velocity.Y < 0 && !_coyoteEnabled.Active)
|
if (Velocity.Y < 0 && IsInputTowardsWall(wallNormal))
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("wall_hug");
|
_playerState.SendEvent("wall_hug");
|
||||||
}
|
}
|
||||||
@@ -724,7 +812,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
var wallHugContactPoint = _onWallRunning.Active ? _currentWallContactPoint : Vector3.Zero;
|
var wallHugContactPoint = _onWallRunning.Active ? _currentWallContactPoint : Vector3.Zero;
|
||||||
var playerVelocity = GetGlobalMoveInput();
|
var playerVelocity = GetGlobalMoveInput();
|
||||||
HeadSystem.LookAround(delta, inputLookDir, playerVelocity, wallHugContactPoint, lookSensitivity);
|
HeadSystem.LookAround(delta, inputLookDir, playerVelocity, Velocity, wallHugContactPoint, lookSensitivity, isSliding: _groundSliding.Active);
|
||||||
}
|
}
|
||||||
public void RotateWeaponWithPlayer()
|
public void RotateWeaponWithPlayer()
|
||||||
{
|
{
|
||||||
@@ -739,7 +827,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
Bobbing.CameraBobbingParams cameraBobbingParams = new Bobbing.CameraBobbingParams
|
Bobbing.CameraBobbingParams cameraBobbingParams = new Bobbing.CameraBobbingParams
|
||||||
{
|
{
|
||||||
Delta = delta,
|
Delta = delta,
|
||||||
IsOnFloorCustom = isOnFloorCustom() || _onWallRunning.Active,
|
IsOnFloorCustom = _grounded.Active || _onWallRunning.Active,
|
||||||
Velocity = Velocity,
|
Velocity = Velocity,
|
||||||
SettingsMultiplier = _headBobbingMultiplier
|
SettingsMultiplier = _headBobbingMultiplier
|
||||||
};
|
};
|
||||||
@@ -747,7 +835,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
FieldOfView.FovParameters fovParams = new FieldOfView.FovParameters
|
FieldOfView.FovParameters fovParams = new FieldOfView.FovParameters
|
||||||
{
|
{
|
||||||
IsCrouchingHeight = CapsuleCollider.IsCrouchingHeight(),
|
IsCrouchingHeight = false,
|
||||||
Delta = delta,
|
Delta = delta,
|
||||||
SprintSpeed = WalkSpeed,
|
SprintSpeed = WalkSpeed,
|
||||||
Velocity = Velocity,
|
Velocity = Velocity,
|
||||||
@@ -839,22 +927,28 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
_playerState.SendEvent("cancel_aim");
|
_playerState.SendEvent("cancel_aim");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (GetMoveInput().Length() < Mathf.Epsilon) return;
|
||||||
|
|
||||||
|
// Buffer dash in case of mantle or inputting dash airborne before touching the ground without air dash available
|
||||||
|
_currentInputBufferFrames = InputBufferFrames;
|
||||||
|
_bufferedAction = _mantling.Active ? BufferedActions.MantleDash : BufferedActions.Dash;
|
||||||
|
|
||||||
if (_airborne.Active)
|
if (_airborne.Active)
|
||||||
{
|
{
|
||||||
if (!_canDashAirborne)
|
if (!_canDashAirborne)
|
||||||
return;
|
return;
|
||||||
_canDashAirborne = false;
|
_canDashAirborne = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
_currentInputBufferFrames = InputBufferFrames;
|
|
||||||
_bufferedAction = _mantling.Active ? BufferedActions.MantleDash : BufferedActions.Dash;
|
|
||||||
_playerState.SendEvent("dash");
|
_playerState.SendEvent("dash");
|
||||||
}
|
}
|
||||||
public void SimpleDashInDirection(Vector3 direction, float strength = -1)
|
public void SimpleDashInDirection(Vector3 direction, float strength = -1)
|
||||||
{
|
{
|
||||||
if (strength < 0) strength = SimpleDashStrength;
|
if (strength < 0) strength = SimpleDashStrength;
|
||||||
SetVelocity(direction * strength);
|
SetVelocity(direction * strength);
|
||||||
|
|
||||||
|
GetTree().CreateTimer(SimpleDashTime).Timeout += SimpleDashFinished;
|
||||||
}
|
}
|
||||||
public void SimpleDash(float strength = -1)
|
public void SimpleDash(float strength = -1)
|
||||||
{
|
{
|
||||||
@@ -863,19 +957,46 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
public void OnSimpleDashStarted()
|
public void OnSimpleDashStarted()
|
||||||
{
|
{
|
||||||
if (!_canDash)
|
if (_bufferedAction == BufferedActions.MantleDash)
|
||||||
|
{
|
||||||
|
SimpleDash(MantleDashStrength);
|
||||||
|
_bufferedAction = BufferedActions.None;
|
||||||
return;
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_canDash)
|
||||||
|
{
|
||||||
|
var dashEvent = isOnFloorCustom() ? "grounded" : "dash_finished";
|
||||||
|
_playerState.SendEvent(dashEvent);
|
||||||
|
return;
|
||||||
|
}
|
||||||
_canDash = false;
|
_canDash = false;
|
||||||
SimpleDash();
|
SimpleDash();
|
||||||
|
_bufferedAction = BufferedActions.None;
|
||||||
}
|
}
|
||||||
public void HandleSimpleDash(float delta)
|
public void HandleSimpleDash(float delta)
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("dash_finished");
|
if (MantleSystem.IsMantlePossible && IsPlayerInputtingForward())
|
||||||
|
{
|
||||||
|
_bufferedAction = BufferedActions.MantleDash;
|
||||||
|
_playerState.SendEvent("mantle");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SimpleDashFinished()
|
||||||
|
{
|
||||||
|
var dashEvent = isOnFloorCustom() ? "grounded" : "dash_finished";
|
||||||
|
_playerState.SendEvent(dashEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// On wall management //
|
// On wall management //
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
|
|
||||||
|
public bool IsInputTowardsWall(Vector3 wallNormal)
|
||||||
|
{
|
||||||
|
return wallNormal.Dot(GetInputGlobalHDirection()) < -0.5;
|
||||||
|
}
|
||||||
public void HandleOnWall(float delta)
|
public void HandleOnWall(float delta)
|
||||||
{
|
{
|
||||||
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
if (IsTryingToMantle()) _playerState.SendEvent("mantle");
|
||||||
@@ -914,10 +1035,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
WallHug(delta);
|
WallHug(delta);
|
||||||
if (isOnFloorCustom())
|
if (isOnFloorCustom())
|
||||||
_playerState.SendEvent("grounded");
|
_playerState.SendEvent("grounded");
|
||||||
if (!WallHugSystem.IsWallHugging())
|
if (!WallHugSystem.IsWallHugging() || !IsInputTowardsWall(_wallHugStartNormal))
|
||||||
{
|
|
||||||
_playerState.SendEvent("start_falling");
|
_playerState.SendEvent("start_falling");
|
||||||
}
|
|
||||||
}
|
}
|
||||||
public void HandleWallHanging(float delta)
|
public void HandleWallHanging(float delta)
|
||||||
{
|
{
|
||||||
@@ -980,7 +1099,9 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public void OnInputJumpStarted()
|
public void OnInputJumpStarted()
|
||||||
{
|
{
|
||||||
_currentInputBufferFrames = InputBufferFrames;
|
_currentInputBufferFrames = InputBufferFrames;
|
||||||
_bufferedAction = _mantling.Active ? BufferedActions.MantleJump : BufferedActions.Jump;
|
if (_mantling.Active) _bufferedAction = BufferedActions.MantleJump;
|
||||||
|
// Don't overwrite mantle jump buffered action
|
||||||
|
else if (_bufferedAction == BufferedActions.None) _bufferedAction = BufferedActions.Jump;
|
||||||
_isJumpInputPressed = true;
|
_isJumpInputPressed = true;
|
||||||
|
|
||||||
PerformJump();
|
PerformJump();
|
||||||
@@ -996,29 +1117,46 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
public void PerformJump()
|
public void PerformJump()
|
||||||
{
|
{
|
||||||
if (MantleSystem.IsMantlePossible)
|
if (MantleSystem.IsMantlePossible && !_mantling.Active)
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("mantle");
|
_playerState.SendEvent("mantle");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (WallHugSystem.IsWallHugging())
|
||||||
|
{
|
||||||
|
_playerState.SendEvent("wall_jump");
|
||||||
|
}
|
||||||
_playerState.SendEvent("jump");
|
_playerState.SendEvent("jump");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private float _jumpStrengthMultiplier = 1.0f;
|
||||||
public void OnJumpStarted(float verticalVelocity)
|
public void OnJumpStarted(float verticalVelocity)
|
||||||
{
|
{
|
||||||
_framesSinceJumpAtApex = 0;
|
_framesSinceJumpAtApex = 0;
|
||||||
SetVerticalVelocity(verticalVelocity);
|
var angle = GetFloorAngle();
|
||||||
|
var floorAngleFactor = angle > 1 ? 1 : 1 + angle;
|
||||||
|
SetVerticalVelocity(verticalVelocity*_jumpStrengthMultiplier*floorAngleFactor);
|
||||||
|
_jumpStrengthMultiplier = 1.0f;
|
||||||
}
|
}
|
||||||
public void OnSimpleJumpStarted()
|
public void OnSimpleJumpStarted()
|
||||||
{
|
{
|
||||||
|
if (_bufferedAction == BufferedActions.MantleJump)
|
||||||
|
{
|
||||||
|
SetVelocity(GetInputGlobalHDirection()*SimpleDashStrength);
|
||||||
|
OnJumpStarted(MantleJumpStartVelocity);
|
||||||
|
_bufferedAction = BufferedActions.None;
|
||||||
|
return;
|
||||||
|
}
|
||||||
OnJumpStarted(SimpleJumpStartVelocity);
|
OnJumpStarted(SimpleJumpStartVelocity);
|
||||||
|
_bufferedAction = BufferedActions.None;
|
||||||
}
|
}
|
||||||
public void OnDoubleJumpStarted()
|
public void OnDoubleJumpStarted()
|
||||||
{
|
{
|
||||||
_canDash = true;
|
_canDash = true;
|
||||||
// _canDashAirborne = true;
|
// _canDashAirborne = true;
|
||||||
OnJumpStarted(DoubleJumpStartVelocity);
|
OnJumpStarted(DoubleJumpStartVelocity);
|
||||||
|
_bufferedAction = BufferedActions.None;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void HandleJump(float delta, float gravityFactor, int hangFrames)
|
public void HandleJump(float delta, float gravityFactor, int hangFrames)
|
||||||
@@ -1133,7 +1271,7 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
var positionDifference = GlobalPosition - _mantleStartPosition;
|
var positionDifference = GlobalPosition - _mantleStartPosition;
|
||||||
var directionHorizontal = new Vector3(positionDifference.X, 0, positionDifference.Z);
|
var directionHorizontal = new Vector3(positionDifference.X, 0, positionDifference.Z);
|
||||||
// SimpleDashInDirection(directionHorizontal.Normalized());
|
// SimpleDashInDirection(directionHorizontal.Normalized());
|
||||||
SetVelocity(directionHorizontal.Normalized() * WalkSpeed);
|
SetVelocity(directionHorizontal.Normalized() * _velocityOnMantleStarted.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
_customMantle = false;
|
_customMantle = false;
|
||||||
@@ -1143,62 +1281,214 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Slide management //
|
// Slide management //
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
|
|
||||||
|
private bool _isSlideInputDown = false;
|
||||||
public void OnInputSlideStarted()
|
public void OnInputSlideStarted()
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("slide");
|
_isSlideInputDown = true;
|
||||||
|
if (Velocity.Length() > WalkSpeed/2f)
|
||||||
|
_playerState.SendEvent("slide");
|
||||||
}
|
}
|
||||||
public void OnInputSlideEnded()
|
public void OnInputSlideEnded()
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("slide_released");
|
_isSlideInputDown = false;
|
||||||
|
if (_airGliding.Active || CanStandUpFromSlide())
|
||||||
|
_playerState.SendEvent("slide_released");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public record SlopeRecord(
|
||||||
|
Vector3 Position,
|
||||||
|
Vector3 Normal,
|
||||||
|
Vector3 Direction,
|
||||||
|
float AngleRadians
|
||||||
|
);
|
||||||
|
public Vector3 GetGroundPosition()
|
||||||
|
{
|
||||||
|
return DirectGroundDetector.GetCollisionPoint();
|
||||||
|
}
|
||||||
|
public Vector3 GetGroundNormal()
|
||||||
|
{
|
||||||
|
return DirectGroundDetector.GetCollisionNormal();
|
||||||
|
}
|
||||||
|
public SlopeRecord GetSlope()
|
||||||
|
{
|
||||||
|
var position = GetGroundPosition();
|
||||||
|
var normal = GetGroundNormal();
|
||||||
|
var angle = normal.AngleTo(Vector3.Up);
|
||||||
|
var vectorInPlane = normal.Cross(Vector3.Up).Normalized();
|
||||||
|
var direction = normal.Cross(vectorInPlane).Normalized();
|
||||||
|
return new SlopeRecord(position, normal, direction, angle);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupSlideCollision()
|
||||||
|
{
|
||||||
|
StandingCollider.Disabled = true;
|
||||||
|
SlideCollider.Disabled = false;
|
||||||
|
CeilingDetector.Enabled = true;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupStandingCollision()
|
||||||
|
{
|
||||||
|
StandingCollider.Disabled = false;
|
||||||
|
SlideCollider.Disabled = true;
|
||||||
|
CeilingDetector.Enabled = false;
|
||||||
|
}
|
||||||
public void SlideStarted()
|
public void SlideStarted()
|
||||||
{
|
{
|
||||||
_targetSpeed = Velocity.Length();
|
_targetSpeed = Velocity.Length();
|
||||||
|
SetupSlideCollision();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanStandUpFromSlide()
|
||||||
|
{
|
||||||
|
return !CeilingDetector.IsColliding();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanCancelSlide()
|
||||||
|
{
|
||||||
|
return DirectGroundDetector.IsColliding()
|
||||||
|
&& Velocity.Length() < WalkSpeed / 2f
|
||||||
|
&& CanStandUpFromSlide();
|
||||||
}
|
}
|
||||||
public void SlideOnGround(float delta)
|
public void SlideOnGround(float delta)
|
||||||
{
|
{
|
||||||
|
// Store current velocity
|
||||||
|
var currentVelocity = Velocity.Length();
|
||||||
|
// We prevent automatically losing speed when sliding under something
|
||||||
|
var speedLossRate = CanStandUpFromSlide() ? FlatGroundSlideSpeedLossRate : 1.0f;
|
||||||
|
// We force a minimum of speed when sliding under something
|
||||||
|
var minimumVelocity = CanStandUpFromSlide() ? 0f : WalkSpeed;
|
||||||
|
var finalSpeed = Mathf.Max(currentVelocity * speedLossRate, minimumVelocity);
|
||||||
|
|
||||||
|
// Going down a slope?
|
||||||
|
var (position, _, slopeDirection, slopeAngleRadians) = GetSlope();
|
||||||
|
|
||||||
|
// Change velocity based on Input
|
||||||
var horizontalVelocity = ComputeHVelocity(delta, AccelerationGroundSlide, DecelerationGroundSlide);
|
var horizontalVelocity = ComputeHVelocity(delta, AccelerationGroundSlide, DecelerationGroundSlide);
|
||||||
Velocity = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z);
|
var newVelocityDirection = new Vector3(horizontalVelocity.X, Velocity.Y, horizontalVelocity.Z).Normalized();
|
||||||
|
var newVelocityHDirection = new Vector3(horizontalVelocity.X, 0, horizontalVelocity.Z).Normalized();
|
||||||
|
// var redirectedVelocity = newVelocityDirection.Slide(normal);
|
||||||
|
|
||||||
|
var redirectedVelocity = newVelocityDirection;
|
||||||
|
if (slopeAngleRadians > Mathf.Epsilon)
|
||||||
|
{
|
||||||
|
var slopeHDirection = new Vector3(slopeDirection.X, 0, slopeDirection.Z);
|
||||||
|
redirectedVelocity = newVelocityDirection.Lerp(slopeHDirection, delta * GroundSlideSlopeMagnetism);
|
||||||
|
|
||||||
|
var angleBetweenVelocityAndSlope = newVelocityHDirection.AngleTo(slopeHDirection);
|
||||||
|
var velocitySlopeAlignment = Mathf.Cos(angleBetweenVelocityAndSlope);
|
||||||
|
var slopeSpeedFactor = Mathf.Remap(velocitySlopeAlignment, -1, 1, 0.98, 1.02);
|
||||||
|
var speedFactorFromDownSlope = Velocity.Length() > GroundSlideDownSlopeMaxSpeed ? 1f : slopeSpeedFactor;
|
||||||
|
finalSpeed *= (float) speedFactorFromDownSlope;
|
||||||
|
|
||||||
|
// var redirectedVVelocity = slopeDirection.Y * velocitySlopeAlignment;
|
||||||
|
// redirectedVelocity = new Vector3(redirectedVelocity.X, redirectedVVelocity, redirectedVelocity.Z);
|
||||||
|
|
||||||
|
// Moving upslope and not enough speed
|
||||||
|
if (velocitySlopeAlignment < 0 && CanCancelSlide())
|
||||||
|
_playerState.SendEvent("slide_canceled");
|
||||||
|
}
|
||||||
|
else if (CanCancelSlide())
|
||||||
|
{
|
||||||
|
// Moving on flat ground and not enough speed
|
||||||
|
_playerState.SendEvent("slide_canceled");
|
||||||
|
}
|
||||||
|
|
||||||
|
// Preserve velocity when changing direction
|
||||||
|
var finalVelocity = redirectedVelocity.Normalized() * finalSpeed;
|
||||||
|
Velocity = finalVelocity;
|
||||||
|
if (DirectGroundDetector.IsColliding())
|
||||||
|
{
|
||||||
|
GlobalPosition = new Vector3(GlobalPosition.X, position.Y, GlobalPosition.Z);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public void OnSlideCanceled()
|
||||||
|
{
|
||||||
|
SetupStandingCollision();
|
||||||
|
_targetSpeed = WalkSpeed;
|
||||||
|
}
|
||||||
|
public void HandleSlideCanceled(float delta)
|
||||||
|
{
|
||||||
|
HandleGrounded(delta);
|
||||||
}
|
}
|
||||||
public void HandleGroundSlide(float delta)
|
public void HandleGroundSlide(float delta)
|
||||||
{
|
{
|
||||||
SlideOnGround(delta);
|
SlideOnGround(delta);
|
||||||
if (MantleSystem.IsMantlePossible && IsPlayerInputtingForward()) _playerState.SendEvent("mantle");
|
|
||||||
|
|
||||||
if (!isOnFloorCustom())
|
if (MantleSystem.IsMantlePossible && IsPlayerInputtingForward()) _playerState.SendEvent("mantle");
|
||||||
_playerState.SendEvent("start_falling");
|
if (!isOnFloorCustom() && !DirectGroundDetector.IsColliding()) _playerState.SendEvent("start_falling");
|
||||||
|
if (CanStandUpFromSlide() && !_isSlideInputDown) _playerState.SendEvent("slide_released");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void GlideInAir(float delta)
|
public void GlideInAir(float delta)
|
||||||
{
|
{
|
||||||
var horizontalVelocity = ComputeHVelocity(delta, AccelerationAirGlide, DecelerationAirGlide);
|
if (AllowForVelocityRedirection)
|
||||||
|
{
|
||||||
float verticalSpeed;
|
// Preserve overall velocity
|
||||||
if (Velocity.Y < -AirGlideVSpeed) verticalSpeed = -AirGlideVSpeed;
|
// Allows for tragic reorientation of the velocity vector after a fall
|
||||||
else if (Velocity.Y > 0) verticalSpeed = ComputeVerticalSpeedGravity(delta);
|
// Allows for bunny-hoping-like movement
|
||||||
else verticalSpeed = Mathf.Lerp(Velocity.Y, -AirGlideVSpeed, delta);
|
var currentVelocity = Velocity.Length();
|
||||||
|
var horizontalVelocity = ComputeHVelocity(delta, AccelerationAirGlide, DecelerationAirGlide);
|
||||||
Velocity = new Vector3(horizontalVelocity.X, verticalSpeed, horizontalVelocity.Z);
|
var verticalSpeed = Velocity.Y > 0 ? ComputeVerticalSpeedGravity(delta) : Mathf.Lerp(Velocity.Y, -AirGlideVSpeed, delta*AirGlideVerticalAcceleration);
|
||||||
|
var newVelocity = new Vector3(horizontalVelocity.X, verticalSpeed, horizontalVelocity.Z);
|
||||||
|
Velocity = newVelocity.Normalized() * currentVelocity;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Preserve horizontal velocity only
|
||||||
|
// Allows for mor stable descent when gliding because you don't zoom away after a long fall
|
||||||
|
// Removes bunny-hoping-like movement by simply holding slide and jump jump jump
|
||||||
|
var currentHVelocity = new Vector2(Velocity.X, Velocity.Z).Length();
|
||||||
|
var horizontalVelocity = ComputeHVelocity(delta, AccelerationAirGlide, DecelerationAirGlide);
|
||||||
|
var newHVelocity = horizontalVelocity.Normalized() * currentHVelocity;
|
||||||
|
var verticalSpeed = Velocity.Y > 0 ? ComputeVerticalSpeedGravity(delta) : Mathf.Lerp(Velocity.Y, -AirGlideVSpeed, delta*AirGlideVerticalAcceleration);
|
||||||
|
var newVelocity = new Vector3(newHVelocity.X, verticalSpeed, newHVelocity.Z);
|
||||||
|
Velocity = newVelocity;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
public void HandleAirGlide(float delta)
|
public void HandleAirGlide(float delta)
|
||||||
{
|
{
|
||||||
GlideInAir(delta);
|
GlideInAir(delta);
|
||||||
if (MantleSystem.IsMantlePossible && IsPlayerInputtingForward()) _playerState.SendEvent("mantle");
|
|
||||||
|
|
||||||
|
if (MantleSystem.IsMantlePossible && IsPlayerInputtingForward()) _playerState.SendEvent("mantle");
|
||||||
if (isOnFloorCustom())
|
if (isOnFloorCustom())
|
||||||
_playerState.SendEvent("grounded");
|
_playerState.SendEvent("grounded");
|
||||||
}
|
}
|
||||||
public void SlideEnded()
|
public void SlideEnded()
|
||||||
{
|
{
|
||||||
|
SetupStandingCollision();
|
||||||
_targetSpeed = WalkSpeed;
|
_targetSpeed = WalkSpeed;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void JumpFromGroundSlide()
|
||||||
|
{
|
||||||
|
_jumpStrengthMultiplier = GroundSlideJumpMultiplier + Velocity.Length()*GroundSlideJumpSpeedFactor;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void JumpFromAirGlide()
|
||||||
|
{
|
||||||
|
_jumpStrengthMultiplier = AirGlideJumpMultiplier + Velocity.Length()*AirGlideJumpSpeedFactor;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Slam Management ///////
|
// Slam Management ///////
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
public void OnInputSlamPressed()
|
public void OnInputSlamPressed()
|
||||||
{
|
{
|
||||||
GD.Print("Slam pressed");
|
_playerState.SendEvent("slam");
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SlamStarted()
|
||||||
|
{
|
||||||
|
SetHorizontalVelocity(Vector2.Zero);
|
||||||
|
SetVerticalVelocity(-SlamSpeed);
|
||||||
|
}
|
||||||
|
public void HandleSlam(float delta)
|
||||||
|
{
|
||||||
|
if (isOnFloorCustom()) _playerState.SendEvent("grounded");
|
||||||
|
}
|
||||||
|
public void SlamEnded()
|
||||||
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -1280,7 +1570,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
}
|
}
|
||||||
public void HandleAiming(float delta)
|
public void HandleAiming(float delta)
|
||||||
{
|
{
|
||||||
RotateWeaponWithPlayer();
|
if (WeaponSystem.InHandState.Active)
|
||||||
|
RotateWeaponWithPlayer();
|
||||||
|
|
||||||
DashIndicatorMeshCylinder.Height = DashSystem.PlannedLocation.DistanceTo(GlobalPosition);
|
DashIndicatorMeshCylinder.Height = DashSystem.PlannedLocation.DistanceTo(GlobalPosition);
|
||||||
DashIndicatorNode.LookAt(DashSystem.PlannedLocation);
|
DashIndicatorNode.LookAt(DashSystem.PlannedLocation);
|
||||||
@@ -1295,17 +1586,6 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
DashIndicatorMesh.Visible = false;
|
DashIndicatorMesh.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////
|
|
||||||
// Hit Management ///////
|
|
||||||
///////////////////////////
|
|
||||||
public void OnInputHitPressed()
|
|
||||||
{
|
|
||||||
if (_aiming.Active)
|
|
||||||
{
|
|
||||||
ThrowWeapon();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Parry Management ///////
|
// Parry Management ///////
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -1346,7 +1626,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
}
|
}
|
||||||
public void AimedDashTweenEnded()
|
public void AimedDashTweenEnded()
|
||||||
{
|
{
|
||||||
_playerState.SendEvent("dash_finished");
|
var dashEvent = isOnFloorCustom() ? "grounded" : "dash_finished";
|
||||||
|
_playerState.SendEvent(dashEvent);
|
||||||
}
|
}
|
||||||
public void OnAimedDashFinished()
|
public void OnAimedDashFinished()
|
||||||
{
|
{
|
||||||
@@ -1438,16 +1719,15 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
|
|
||||||
LookAround(delta);
|
LookAround(delta);
|
||||||
CameraModifications((float) delta);
|
CameraModifications((float) delta);
|
||||||
HandleStairs((float) delta);
|
MoveSlideAndHandleStairs((float) delta);
|
||||||
MantleSystem.ProcessMantle(_grounded.Active);
|
MantleSystem.ProcessMantle(_grounded.Active);
|
||||||
|
|
||||||
if (WeaponSystem.InHandState.Active)
|
if (WeaponSystem.InHandState.Active)
|
||||||
RotateWeaponWithPlayer();
|
RotateWeaponWithPlayer();
|
||||||
|
|
||||||
if (WeaponSystem.InHandState.Active && !_aiming.Active && TutorialDone)
|
if (WeaponSystem.InHandState.Active && !_aiming.Active && TutorialDone)
|
||||||
{
|
{
|
||||||
DashIndicatorMesh.Visible = false;
|
DashIndicatorMesh.Visible = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!WeaponSystem.InHandState.Active && TutorialDone)
|
if (!WeaponSystem.InHandState.Active && TutorialDone)
|
||||||
{
|
{
|
||||||
DashIndicatorMesh.Visible = true;
|
DashIndicatorMesh.Visible = true;
|
||||||
@@ -1457,5 +1737,29 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public DamageRecord TakeDamage(DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
var finalDamage = CDamage.TakeDamage(damageRecord);
|
||||||
|
DamageTaken?.Invoke(this, finalDamage);
|
||||||
|
return finalDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////
|
||||||
|
// Hit Management ///////
|
||||||
|
///////////////////////////
|
||||||
|
public void OnInputHitPressed()
|
||||||
|
{
|
||||||
|
if (_aiming.Active && WeaponSystem.InHandState.Active)
|
||||||
|
{
|
||||||
|
ThrowWeapon();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!WeaponSystem.InHandState.Active) return;
|
||||||
|
var bodies = WeaponHitbox.GetOverlappingBodies();
|
||||||
|
foreach (var body in bodies)
|
||||||
|
{
|
||||||
|
if(body is IDamageable spawnable)
|
||||||
|
spawnable.TakeDamage(new DamageRecord(this, RDamage));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,6 +146,16 @@ aim_dash={
|
|||||||
|
|
||||||
locale/translations=PackedStringArray("res://addons/maaacks_game_template/base/translations/menus_translations.en.translation", "res://addons/maaacks_game_template/base/translations/menus_translations.fr.translation")
|
locale/translations=PackedStringArray("res://addons/maaacks_game_template/base/translations/menus_translations.en.translation", "res://addons/maaacks_game_template/base/translations/menus_translations.fr.translation")
|
||||||
|
|
||||||
|
[layer_names]
|
||||||
|
|
||||||
|
3d_physics/layer_1="Player"
|
||||||
|
3d_physics/layer_2="2"
|
||||||
|
3d_physics/layer_3="3"
|
||||||
|
3d_physics/layer_4="4"
|
||||||
|
3d_physics/layer_5="enemies"
|
||||||
|
3d_physics/layer_9="terrain"
|
||||||
|
3d_physics/layer_17="weapon"
|
||||||
|
|
||||||
[maaacks_game_template]
|
[maaacks_game_template]
|
||||||
|
|
||||||
disable_update_check=false
|
disable_update_check=false
|
||||||
@@ -154,6 +164,7 @@ copy_path="res://scenes"
|
|||||||
|
|
||||||
[physics]
|
[physics]
|
||||||
|
|
||||||
|
3d/run_on_separate_thread=true
|
||||||
common/physics_jitter_fix=0.0
|
common/physics_jitter_fix=0.0
|
||||||
3d/physics_engine="Jolt Physics"
|
3d/physics_engine="Jolt Physics"
|
||||||
common/physics_interpolation=true
|
common/physics_interpolation=true
|
||||||
|
|||||||
154
scenes/enemies/Enemy.cs
Normal file
154
scenes/enemies/Enemy.cs
Normal file
@@ -0,0 +1,154 @@
|
|||||||
|
using System;
|
||||||
|
using Godot;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class Enemy : CharacterBody3D,
|
||||||
|
IDamageable,
|
||||||
|
IDamageDealer,
|
||||||
|
IHealthable,
|
||||||
|
IKillable,
|
||||||
|
IMoveable,
|
||||||
|
ISpawnable,
|
||||||
|
IKnockbackable
|
||||||
|
{
|
||||||
|
// Signals and events
|
||||||
|
public event Action<IDamageable, DamageRecord> DamageTaken;
|
||||||
|
public event Action<IHealthable, float> HealthChanged;
|
||||||
|
public event Action<IHealthable> HealthDepleted;
|
||||||
|
|
||||||
|
// Public export components
|
||||||
|
[Export]
|
||||||
|
public Node3D Target { get; set; }
|
||||||
|
|
||||||
|
[ExportGroup("Health")]
|
||||||
|
[Export]
|
||||||
|
public Node CHealth { get; set; }
|
||||||
|
[Export]
|
||||||
|
public RHealth RHealth { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RDeathEffect[] DeathEffects { get; set; }
|
||||||
|
|
||||||
|
[ExportGroup("Damage")]
|
||||||
|
[Export]
|
||||||
|
public Node CDamage { get; set; }
|
||||||
|
[Export]
|
||||||
|
public RDamage RDamage { get; set; }
|
||||||
|
[Export]
|
||||||
|
public Node CKnockback { get; set; }
|
||||||
|
[Export]
|
||||||
|
public RKnockback RKnockback { get; set; }
|
||||||
|
|
||||||
|
[ExportGroup("Movement")]
|
||||||
|
[Export]
|
||||||
|
public Node CMovement { get; set; }
|
||||||
|
[Export]
|
||||||
|
public RMovement RMovement { get; set; }
|
||||||
|
|
||||||
|
// Public stuff
|
||||||
|
public float CurrentHealth { get; set; }
|
||||||
|
|
||||||
|
// Private stuff
|
||||||
|
private Area3D _damageBox;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
Initialize();
|
||||||
|
SetupSignals();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Initialize()
|
||||||
|
{
|
||||||
|
_damageBox = GetNode<Area3D>("DamageBox");
|
||||||
|
|
||||||
|
if (CMovement is IMoveable moveable && RMovement != null) moveable.RMovement = RMovement;
|
||||||
|
if (CHealth is IHealthable healthable && RHealth != null)
|
||||||
|
{
|
||||||
|
healthable.RHealth = RHealth;
|
||||||
|
healthable.CurrentHealth = RHealth.StartingHealth;
|
||||||
|
}
|
||||||
|
if (CKnockback is IKnockbackable knockbackable && RKnockback != null) knockbackable.RKnockback = RKnockback;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetupSignals()
|
||||||
|
{
|
||||||
|
_damageBox.BodyEntered += OnDamageBoxTriggered;
|
||||||
|
if (CDamage is IDamageable damageable)
|
||||||
|
{
|
||||||
|
damageable.DamageTaken += ReduceHealth;
|
||||||
|
damageable.DamageTaken += RegisterKnockback;
|
||||||
|
}
|
||||||
|
if (CHealth is IHealthable healthable) healthable.HealthDepleted += Kill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _PhysicsProcess(double delta)
|
||||||
|
{
|
||||||
|
var targetPlanar = new Vector3(Target.GlobalPosition.X, GlobalPosition.Y, Target.GlobalPosition.Z);
|
||||||
|
LookAt(targetPlanar);
|
||||||
|
|
||||||
|
var inputs = new MovementInputs(
|
||||||
|
Velocity: Velocity,
|
||||||
|
TargetLocation: Target.GlobalPosition,
|
||||||
|
isOnFloor: IsOnFloor(),
|
||||||
|
gravity: GetGravity(),
|
||||||
|
delta: delta
|
||||||
|
);
|
||||||
|
Velocity = ComputeVelocity(inputs);
|
||||||
|
Velocity += ComputeKnockback();
|
||||||
|
MoveAndSlide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 ComputeVelocity(MovementInputs inputs)
|
||||||
|
{
|
||||||
|
if (CMovement is not IMoveable movement) return Vector3.Zero;
|
||||||
|
return movement!.ComputeVelocity(inputs);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDamageBoxTriggered(Node3D body)
|
||||||
|
{
|
||||||
|
if (body is not IDamageable damageable) return;
|
||||||
|
|
||||||
|
var damageRecord = new DamageRecord(this, RDamage);
|
||||||
|
damageable.TakeDamage(damageRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
public DamageRecord TakeDamage(DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
if (CDamage is not IDamageable damageable)
|
||||||
|
return damageRecord with { Damage = new RDamage(0, damageRecord.Damage.DamageType) };
|
||||||
|
|
||||||
|
var finalDamage = damageable.TakeDamage(damageRecord);
|
||||||
|
DamageTaken?.Invoke(this, finalDamage);
|
||||||
|
|
||||||
|
GD.Print($"Received damage: {finalDamage.Damage.DamageDealt}");
|
||||||
|
return finalDamage;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReduceHealth(IDamageable source, DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
if (CHealth is not IHealthable healthable) return;
|
||||||
|
healthable.ReduceHealth(source, damageRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Kill(IHealthable source)
|
||||||
|
{
|
||||||
|
foreach (var killable in DeathEffects.ToIKillables())
|
||||||
|
{
|
||||||
|
killable.Kill(source);
|
||||||
|
}
|
||||||
|
QueueFree();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterKnockback(IDamageable source, DamageRecord damageRecord)
|
||||||
|
{
|
||||||
|
if (CKnockback is not IKnockbackable knockbackable) return;
|
||||||
|
knockbackable.RegisterKnockback(source, damageRecord);
|
||||||
|
}
|
||||||
|
|
||||||
|
public Vector3 ComputeKnockback()
|
||||||
|
{
|
||||||
|
if (CKnockback is not IKnockbackable knockbackable) return Vector3.Zero;
|
||||||
|
return knockbackable.ComputeKnockback();
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scenes/enemies/Enemy.cs.uid
Normal file
1
scenes/enemies/Enemy.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bn7sc6id7n166
|
||||||
111
scenes/enemies/flying_enemy/flying_enemy.tscn
Normal file
111
scenes/enemies/flying_enemy/flying_enemy.tscn
Normal file
@@ -0,0 +1,111 @@
|
|||||||
|
[gd_scene load_steps=20 format=3 uid="uid://cmlud1hwkd6sv"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bn7sc6id7n166" path="res://scenes/enemies/Enemy.cs" id="1_q8l7o"]
|
||||||
|
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://components/damage/RDamageModifier.cs" id="2_1bsgx"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dg1xbjhyhgnnk" path="res://scenes/enemies/flying_enemy/flying_enemy_health.tres" id="2_ma2bq"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="2_on7rt"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bwqjaom4k7rc3" path="res://scenes/enemies/flying_enemy/flying_enemy_movement.tres" id="4_dejyg"]
|
||||||
|
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://components/health/CHealth.cs" id="4_ys4jv"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dmw5ibwrb483f" path="res://components/movement/CFlyingMovement.tscn" id="7_vaeds"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://components/movement/RMovement.cs" id="8_on7rt"]
|
||||||
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://components/damage/CDamageable.cs" id="8_uotso"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://components/knockback/CKnockback.tscn" id="10_dejyg"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dt7a1io5o0b8s" path="res://scenes/enemies/flying_enemy/flying_enemy_knockback.tres" id="11_mpa2u"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_jnv07"]
|
||||||
|
script = ExtResource("2_1bsgx")
|
||||||
|
metadata/_custom_type_script = "uid://b6y3ugfydvch0"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_53j1c"]
|
||||||
|
script = ExtResource("2_1bsgx")
|
||||||
|
DamageType = 1
|
||||||
|
metadata/_custom_type_script = "uid://b6y3ugfydvch0"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_on7rt"]
|
||||||
|
script = ExtResource("8_on7rt")
|
||||||
|
Speed = 3.0
|
||||||
|
TargetHeight = 10.0
|
||||||
|
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
|
||||||
|
|
||||||
|
[sub_resource type="SphereShape3D" id="SphereShape3D_b46rq"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereMesh" id="SphereMesh_1bsgx"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereMesh" id="SphereMesh_4yfjf"]
|
||||||
|
radius = 0.05
|
||||||
|
height = 0.1
|
||||||
|
radial_segments = 4
|
||||||
|
rings = 4
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4yfjf"]
|
||||||
|
albedo_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_4yfjf"]
|
||||||
|
size = Vector3(1, 1, 1.5)
|
||||||
|
|
||||||
|
[node name="FlyingEnemy" type="CharacterBody3D" node_paths=PackedStringArray("CHealth", "CDamage", "CKnockback", "CMovement")]
|
||||||
|
collision_layer = 16
|
||||||
|
collision_mask = 273
|
||||||
|
motion_mode = 1
|
||||||
|
script = ExtResource("1_q8l7o")
|
||||||
|
CHealth = NodePath("CHealth")
|
||||||
|
RHealth = ExtResource("2_ma2bq")
|
||||||
|
DeathEffects = Array[Object]([])
|
||||||
|
CDamage = NodePath("CDamageable")
|
||||||
|
RDamage = ExtResource("2_on7rt")
|
||||||
|
CKnockback = NodePath("CKnockback")
|
||||||
|
RKnockback = ExtResource("11_mpa2u")
|
||||||
|
CMovement = NodePath("CFlyingMovement")
|
||||||
|
RMovement = ExtResource("4_dejyg")
|
||||||
|
|
||||||
|
[node name="CHealth" type="Node" parent="."]
|
||||||
|
script = ExtResource("4_ys4jv")
|
||||||
|
RHealth = ExtResource("2_ma2bq")
|
||||||
|
metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
|
||||||
|
|
||||||
|
[node name="CDamageable" type="Node" parent="."]
|
||||||
|
script = ExtResource("8_uotso")
|
||||||
|
DamageModifiers = Array[Object]([SubResource("Resource_jnv07"), SubResource("Resource_53j1c")])
|
||||||
|
metadata/_custom_type_script = "uid://b0u23nkpaimyc"
|
||||||
|
|
||||||
|
[node name="CFlyingMovement" parent="." instance=ExtResource("7_vaeds")]
|
||||||
|
RMovement = SubResource("Resource_on7rt")
|
||||||
|
TerrainCollision = 256
|
||||||
|
|
||||||
|
[node name="CKnockback" parent="." instance=ExtResource("10_dejyg")]
|
||||||
|
RKnockback = ExtResource("11_mpa2u")
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
shape = SubResource("SphereShape3D_b46rq")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
layers = 33
|
||||||
|
mesh = SubResource("SphereMesh_1bsgx")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 0, -0.5)
|
||||||
|
layers = 33
|
||||||
|
cast_shadow = 0
|
||||||
|
ignore_occlusion_culling = true
|
||||||
|
mesh = SubResource("SphereMesh_4yfjf")
|
||||||
|
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D3" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 0, -0.5)
|
||||||
|
layers = 33
|
||||||
|
cast_shadow = 0
|
||||||
|
ignore_occlusion_culling = true
|
||||||
|
mesh = SubResource("SphereMesh_4yfjf")
|
||||||
|
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
|
||||||
|
|
||||||
|
[node name="GroundDistance" type="RayCast3D" parent="."]
|
||||||
|
target_position = Vector3(0, 0, 0)
|
||||||
|
collision_mask = 272
|
||||||
|
|
||||||
|
[node name="DamageBox" type="Area3D" parent="."]
|
||||||
|
collision_layer = 0
|
||||||
|
monitorable = false
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="DamageBox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -0.75)
|
||||||
|
shape = SubResource("BoxShape3D_4yfjf")
|
||||||
8
scenes/enemies/flying_enemy/flying_enemy_damage.tres
Normal file
8
scenes/enemies/flying_enemy/flying_enemy_damage.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RDamage" load_steps=2 format=3 uid="uid://dgo65k2ceqfvy"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://components/damage/RDamage.cs" id="1_h6law"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_h6law")
|
||||||
|
DamageType = 3
|
||||||
|
metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||||
8
scenes/enemies/flying_enemy/flying_enemy_health.tres
Normal file
8
scenes/enemies/flying_enemy/flying_enemy_health.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RHealth" load_steps=2 format=3 uid="uid://dg1xbjhyhgnnk"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://components/health/RHealth.cs" id="1_jht15"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_jht15")
|
||||||
|
StartingHealth = 50.0
|
||||||
|
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||||
8
scenes/enemies/flying_enemy/flying_enemy_knockback.tres
Normal file
8
scenes/enemies/flying_enemy/flying_enemy_knockback.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RKnockback" load_steps=2 format=3 uid="uid://dt7a1io5o0b8s"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://components/knockback/RKnockback.cs" id="1_yq03x"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_yq03x")
|
||||||
|
Modifier = 10.0
|
||||||
|
metadata/_custom_type_script = "uid://b44cse62qru7j"
|
||||||
10
scenes/enemies/flying_enemy/flying_enemy_movement.tres
Normal file
10
scenes/enemies/flying_enemy/flying_enemy_movement.tres
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RMovement" load_steps=2 format=3 uid="uid://bwqjaom4k7rc3"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://components/movement/RMovement.cs" id="1_3yq0a"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_3yq0a")
|
||||||
|
Speed = 3.0
|
||||||
|
Acceleration = 5.0
|
||||||
|
TargetHeight = 10.0
|
||||||
|
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
|
||||||
107
scenes/enemies/grounded_enemy/grounded_enemy.tscn
Normal file
107
scenes/enemies/grounded_enemy/grounded_enemy.tscn
Normal file
@@ -0,0 +1,107 @@
|
|||||||
|
[gd_scene load_steps=19 format=3 uid="uid://dxt0e2ugmttqq"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://bn7sc6id7n166" path="res://scenes/enemies/Enemy.cs" id="1_r6506"]
|
||||||
|
[ext_resource type="Resource" uid="uid://otfc2snh8umc" path="res://scenes/enemies/grounded_enemy/grounded_enemy_damage.tres" id="2_bn56u"]
|
||||||
|
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://components/health/CHealth.cs" id="2_gsmti"]
|
||||||
|
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://components/damage/RDamageModifier.cs" id="2_r3cnf"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bohbojc68j7y1" path="res://scenes/enemies/grounded_enemy/grounded_enemy_health.tres" id="2_w4lm8"]
|
||||||
|
[ext_resource type="Resource" uid="uid://bqq6uukbdfysr" path="res://scenes/enemies/grounded_enemy/grounded_enemy_movement.tres" id="4_na24f"]
|
||||||
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://components/damage/CDamageable.cs" id="7_1tw73"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://components/movement/CGroundedMovement.tscn" id="7_qyswd"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://components/movement/RMovement.cs" id="8_6d4gl"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://bctpe34ddamg5" path="res://components/knockback/CKnockback.tscn" id="10_jqqi6"]
|
||||||
|
[ext_resource type="Resource" uid="uid://cektf6waf4s04" path="res://scenes/enemies/grounded_enemy/grounded_enemy_knockback.tres" id="11_8k3xb"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_qj0ob"]
|
||||||
|
script = ExtResource("2_r3cnf")
|
||||||
|
Modifier = 3.0
|
||||||
|
metadata/_custom_type_script = "uid://b6y3ugfydvch0"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_6d4gl"]
|
||||||
|
script = ExtResource("8_6d4gl")
|
||||||
|
Speed = 5.0
|
||||||
|
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_62kkh"]
|
||||||
|
|
||||||
|
[sub_resource type="CapsuleMesh" id="CapsuleMesh_3uydm"]
|
||||||
|
|
||||||
|
[sub_resource type="SphereMesh" id="SphereMesh_4yfjf"]
|
||||||
|
radius = 0.05
|
||||||
|
height = 0.1
|
||||||
|
radial_segments = 4
|
||||||
|
rings = 4
|
||||||
|
|
||||||
|
[sub_resource type="StandardMaterial3D" id="StandardMaterial3D_4yfjf"]
|
||||||
|
albedo_color = Color(0.06469653, 0.06469653, 0.06469653, 1)
|
||||||
|
|
||||||
|
[sub_resource type="BoxShape3D" id="BoxShape3D_4yfjf"]
|
||||||
|
size = Vector3(1, 2, 2)
|
||||||
|
|
||||||
|
[node name="GroundedEnemy" type="CharacterBody3D" node_paths=PackedStringArray("CHealth", "CDamage", "CKnockback", "CMovement")]
|
||||||
|
collision_layer = 16
|
||||||
|
collision_mask = 273
|
||||||
|
script = ExtResource("1_r6506")
|
||||||
|
CHealth = NodePath("CHealth")
|
||||||
|
RHealth = ExtResource("2_w4lm8")
|
||||||
|
DeathEffects = Array[Object]([])
|
||||||
|
CDamage = NodePath("CDamageable")
|
||||||
|
RDamage = ExtResource("2_bn56u")
|
||||||
|
CKnockback = NodePath("CKnockback")
|
||||||
|
RKnockback = ExtResource("11_8k3xb")
|
||||||
|
CMovement = NodePath("CGroundedMovement")
|
||||||
|
RMovement = ExtResource("4_na24f")
|
||||||
|
|
||||||
|
[node name="CHealth" type="Node" parent="."]
|
||||||
|
script = ExtResource("2_gsmti")
|
||||||
|
RHealth = ExtResource("2_w4lm8")
|
||||||
|
metadata/_custom_type_script = "uid://bjwrpv3jpsc1e"
|
||||||
|
|
||||||
|
[node name="CDamageable" type="Node" parent="."]
|
||||||
|
script = ExtResource("7_1tw73")
|
||||||
|
DamageModifiers = Array[Object]([SubResource("Resource_qj0ob")])
|
||||||
|
metadata/_custom_type_script = "uid://b0u23nkpaimyc"
|
||||||
|
|
||||||
|
[node name="CGroundedMovement" parent="." node_paths=PackedStringArray("WallInFrontRayCast") instance=ExtResource("7_qyswd")]
|
||||||
|
RMovement = SubResource("Resource_6d4gl")
|
||||||
|
WallInFrontRayCast = NodePath("../WallInFrontRayCast")
|
||||||
|
|
||||||
|
[node name="CKnockback" parent="." instance=ExtResource("10_jqqi6")]
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
|
shape = SubResource("CapsuleShape3D_62kkh")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, 0)
|
||||||
|
layers = 33
|
||||||
|
mesh = SubResource("CapsuleMesh_3uydm")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D2" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -0.2, 1.5, -0.5)
|
||||||
|
layers = 33
|
||||||
|
cast_shadow = 0
|
||||||
|
ignore_occlusion_culling = true
|
||||||
|
mesh = SubResource("SphereMesh_4yfjf")
|
||||||
|
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
|
||||||
|
|
||||||
|
[node name="MeshInstance3D3" type="MeshInstance3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0.2, 1.5, -0.5)
|
||||||
|
layers = 33
|
||||||
|
cast_shadow = 0
|
||||||
|
ignore_occlusion_culling = true
|
||||||
|
mesh = SubResource("SphereMesh_4yfjf")
|
||||||
|
surface_material_override/0 = SubResource("StandardMaterial3D_4yfjf")
|
||||||
|
|
||||||
|
[node name="WallInFrontRayCast" type="RayCast3D" parent="."]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0.1, 0)
|
||||||
|
target_position = Vector3(0, 0, -1.5)
|
||||||
|
collision_mask = 272
|
||||||
|
|
||||||
|
[node name="DamageBox" type="Area3D" parent="."]
|
||||||
|
collision_layer = 0
|
||||||
|
monitorable = false
|
||||||
|
|
||||||
|
[node name="CollisionShape3D" type="CollisionShape3D" parent="DamageBox"]
|
||||||
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1, -0.5)
|
||||||
|
shape = SubResource("BoxShape3D_4yfjf")
|
||||||
8
scenes/enemies/grounded_enemy/grounded_enemy_damage.tres
Normal file
8
scenes/enemies/grounded_enemy/grounded_enemy_damage.tres
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RDamage" load_steps=2 format=3 uid="uid://otfc2snh8umc"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://components/damage/RDamage.cs" id="1_y415a"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_y415a")
|
||||||
|
DamageDealt = 2.0
|
||||||
|
metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||||
7
scenes/enemies/grounded_enemy/grounded_enemy_health.tres
Normal file
7
scenes/enemies/grounded_enemy/grounded_enemy_health.tres
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RHealth" load_steps=2 format=3 uid="uid://bohbojc68j7y1"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://components/health/RHealth.cs" id="1_h6jgd"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_h6jgd")
|
||||||
|
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RKnockback" load_steps=2 format=3 uid="uid://cektf6waf4s04"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://b44cse62qru7j" path="res://components/knockback/RKnockback.cs" id="1_vdia8"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_vdia8")
|
||||||
|
Modifier = 10.0
|
||||||
|
metadata/_custom_type_script = "uid://b44cse62qru7j"
|
||||||
10
scenes/enemies/grounded_enemy/grounded_enemy_movement.tres
Normal file
10
scenes/enemies/grounded_enemy/grounded_enemy_movement.tres
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_resource type="Resource" script_class="RMovement" load_steps=2 format=3 uid="uid://bqq6uukbdfysr"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://components/movement/RMovement.cs" id="1_hsy8g"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_hsy8g")
|
||||||
|
Speed = 5.0
|
||||||
|
Acceleration = 3.0
|
||||||
|
GravityModifier = 5.0
|
||||||
|
metadata/_custom_type_script = "uid://dtpxijlnb2c5"
|
||||||
69
scenes/spawners/Spawner.cs
Normal file
69
scenes/spawners/Spawner.cs
Normal file
@@ -0,0 +1,69 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class Spawner : Node3D
|
||||||
|
{
|
||||||
|
[Export(PropertyHint.NodeType)]
|
||||||
|
public PackedScene EnemyToSpawn { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RMovement MovementInputs { get; set; }
|
||||||
|
[Export]
|
||||||
|
public RHealth HealthInputs { get; set; }
|
||||||
|
[Export]
|
||||||
|
public RDamage DamageInputs { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Node3D Target { get; set; }
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "0.1, 100, 0.1, or_greater")]
|
||||||
|
public float SpawnInterval { get; set; } = 1.0f;
|
||||||
|
[Export]
|
||||||
|
public bool IsActiveOnStart { get; set; } = true;
|
||||||
|
|
||||||
|
private float _spawnTimer;
|
||||||
|
private bool _isActive;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_isActive = IsActiveOnStart;
|
||||||
|
_spawnTimer = SpawnInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _Process(double delta)
|
||||||
|
{
|
||||||
|
if (!_isActive) return;
|
||||||
|
|
||||||
|
_spawnTimer -= (float) delta;
|
||||||
|
if (_spawnTimer <= 0) Spawn();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Spawn()
|
||||||
|
{
|
||||||
|
if (EnemyToSpawn == null || !EnemyToSpawn.CanInstantiate()) return;
|
||||||
|
|
||||||
|
if (EnemyToSpawn.Instantiate() is not Enemy spawnedInstance) return;
|
||||||
|
|
||||||
|
spawnedInstance.Target = Target;
|
||||||
|
spawnedInstance.RMovement = MovementInputs;
|
||||||
|
spawnedInstance.RDamage = DamageInputs;
|
||||||
|
spawnedInstance.RHealth = HealthInputs;
|
||||||
|
spawnedInstance.Initialize();
|
||||||
|
|
||||||
|
GetTree().GetCurrentScene().AddChild(spawnedInstance);
|
||||||
|
spawnedInstance.GlobalPosition = GlobalPosition;
|
||||||
|
|
||||||
|
_spawnTimer = SpawnInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StartSpawning()
|
||||||
|
{
|
||||||
|
_isActive = true;
|
||||||
|
_spawnTimer = SpawnInterval;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void StopSpawning()
|
||||||
|
{
|
||||||
|
_isActive = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scenes/spawners/Spawner.cs.uid
Normal file
1
scenes/spawners/Spawner.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://djyspwixi01j5
|
||||||
10
scenes/spawners/spawner.tscn
Normal file
10
scenes/spawners/spawner.tscn
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
[gd_scene load_steps=3 format=3 uid="uid://c305mfrtumcyq"]
|
||||||
|
|
||||||
|
[ext_resource type="Script" uid="uid://djyspwixi01j5" path="res://scenes/spawners/Spawner.cs" id="1_2otbo"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/grounded_enemy/grounded_enemy.tscn" id="2_2otbo"]
|
||||||
|
|
||||||
|
[node name="Spawner" type="Node3D"]
|
||||||
|
script = ExtResource("1_2otbo")
|
||||||
|
SceneToSpawn = ExtResource("2_2otbo")
|
||||||
|
|
||||||
|
[node name="Marker3D" type="Marker3D" parent="."]
|
||||||
@@ -10,7 +10,6 @@ font_size = 30
|
|||||||
|
|
||||||
[node name="TutoTrigger" type="Area3D"]
|
[node name="TutoTrigger" type="Area3D"]
|
||||||
collision_layer = 0
|
collision_layer = 0
|
||||||
collision_mask = 16
|
|
||||||
script = ExtResource("1_w8mpv")
|
script = ExtResource("1_w8mpv")
|
||||||
|
|
||||||
[node name="Control" type="Control" parent="."]
|
[node name="Control" type="Control" parent="."]
|
||||||
|
|||||||
9
systems/damage/EDamageTypes.cs
Normal file
9
systems/damage/EDamageTypes.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
namespace Movementtests.systems.damage;
|
||||||
|
|
||||||
|
public enum EDamageTypes
|
||||||
|
{
|
||||||
|
Normal,
|
||||||
|
Fire,
|
||||||
|
Ice,
|
||||||
|
Explosion,
|
||||||
|
}
|
||||||
1
systems/damage/EDamageTypes.cs.uid
Normal file
1
systems/damage/EDamageTypes.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dubmiwfuunxmu
|
||||||
@@ -28,7 +28,7 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.6, 0)
|
|||||||
shape = SubResource("SphereShape3D_jngg2")
|
shape = SubResource("SphereShape3D_jngg2")
|
||||||
target_position = Vector3(0, 0, -12)
|
target_position = Vector3(0, 0, -12)
|
||||||
max_results = 1
|
max_results = 1
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
debug_shape_custom_color = Color(0.911631, 0.11884, 0.656218, 1)
|
debug_shape_custom_color = Color(0.911631, 0.11884, 0.656218, 1)
|
||||||
|
|
||||||
[node name="DashCastDrop" type="ShapeCast3D" parent="."]
|
[node name="DashCastDrop" type="ShapeCast3D" parent="."]
|
||||||
@@ -36,7 +36,7 @@ transform = Transform3D(1, 0, 0, 0, -4.371139e-08, 1, 0, -1, -4.371139e-08, 0, 1
|
|||||||
shape = SubResource("SphereShape3D_jngg2")
|
shape = SubResource("SphereShape3D_jngg2")
|
||||||
target_position = Vector3(0, 0, -50)
|
target_position = Vector3(0, 0, -50)
|
||||||
max_results = 1
|
max_results = 1
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
debug_shape_custom_color = Color(0.911631, 0.11884, 0.656218, 1)
|
debug_shape_custom_color = Color(0.911631, 0.11884, 0.656218, 1)
|
||||||
|
|
||||||
[node name="DashTarget" type="MeshInstance3D" parent="."]
|
[node name="DashTarget" type="MeshInstance3D" parent="."]
|
||||||
|
|||||||
@@ -22,12 +22,26 @@ public partial class HeadSystem : Node3D
|
|||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
public float GroundedCameraIncline { get; set; } = 5f;
|
public float GroundedCameraIncline { get; set; } = 5f;
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "0,2,0.1,or_greater")]
|
||||||
|
public float SlidingCameraHeightOffset { get; set; } = 1.0f;
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
|
public float SlidingJitterFrequency { get; set; } = 0.01f;
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
||||||
|
public float SlidingJitterAmplitude { get; set; } = 0.1f;
|
||||||
|
|
||||||
|
private FastNoiseLite _slidingNoise = new FastNoiseLite();
|
||||||
|
|
||||||
public void Init()
|
public void Init()
|
||||||
{
|
{
|
||||||
Input.SetMouseMode(Input.MouseModeEnum.Captured);
|
Input.SetMouseMode(Input.MouseModeEnum.Captured);
|
||||||
_camera = GetNode<Camera3D>("CameraSmooth/Camera3D");
|
_camera = GetNode<Camera3D>("CameraSmooth/Camera3D");
|
||||||
_cameraAnchor = GetNode<Marker3D>("CameraAnchor");
|
_cameraAnchor = GetNode<Marker3D>("CameraAnchor");
|
||||||
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
_animationPlayer = GetNode<AnimationPlayer>("AnimationPlayer");
|
||||||
|
|
||||||
|
_slidingNoise.NoiseType = FastNoiseLite.NoiseTypeEnum.Perlin;
|
||||||
|
_slidingNoise.SetFrequency(SlidingJitterFrequency);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OnMantle()
|
public void OnMantle()
|
||||||
@@ -35,7 +49,7 @@ public partial class HeadSystem : Node3D
|
|||||||
_animationPlayer.Play("mantle");
|
_animationPlayer.Play("mantle");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void LookAround(double delta, Vector2 lookDir, Vector3 playerVelocity, Vector3? wallContactPoint = null, float sensitivitMultiplier = 1f)
|
public void LookAround(double delta, Vector2 lookDir, Vector3 playerInput, Vector3 playerVelocity, Vector3? wallContactPoint = null, float sensitivitMultiplier = 1f, bool isSliding = false)
|
||||||
{
|
{
|
||||||
// Horizontal movement of head
|
// Horizontal movement of head
|
||||||
float angleForHorizontalRotation = lookDir.X * LookSensitivity * sensitivitMultiplier;
|
float angleForHorizontalRotation = lookDir.X * LookSensitivity * sensitivitMultiplier;
|
||||||
@@ -46,8 +60,9 @@ public partial class HeadSystem : Node3D
|
|||||||
currentCameraRotation.X += Convert.ToSingle(lookDir.Y * LookSensitivity * sensitivitMultiplier);
|
currentCameraRotation.X += Convert.ToSingle(lookDir.Y * LookSensitivity * sensitivitMultiplier);
|
||||||
currentCameraRotation.X = Mathf.Clamp(currentCameraRotation.X, Mathf.DegToRad(-90f), Mathf.DegToRad(90f));
|
currentCameraRotation.X = Mathf.Clamp(currentCameraRotation.X, Mathf.DegToRad(-90f), Mathf.DegToRad(90f));
|
||||||
|
|
||||||
|
// Camera incline on Wall and more
|
||||||
var isWallRunning = wallContactPoint.HasValue && wallContactPoint.Value.Length() > Mathf.Epsilon;
|
var isWallRunning = wallContactPoint.HasValue && wallContactPoint.Value.Length() > Mathf.Epsilon;
|
||||||
var cameraIncline = 0f;
|
float cameraIncline;
|
||||||
if (isWallRunning)
|
if (isWallRunning)
|
||||||
{
|
{
|
||||||
var directionToWall = (wallContactPoint.Value - GlobalPosition).Normalized();
|
var directionToWall = (wallContactPoint.Value - GlobalPosition).Normalized();
|
||||||
@@ -56,11 +71,23 @@ public partial class HeadSystem : Node3D
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var cameraInclineFactor = ComputeCameraInclineFactor(playerVelocity);
|
var cameraInclineFactor = ComputeCameraInclineFactor(playerInput);
|
||||||
cameraIncline = Mathf.DegToRad(GroundedCameraIncline * cameraInclineFactor * -1.0f);
|
cameraIncline = Mathf.DegToRad(GroundedCameraIncline * cameraInclineFactor * -1.0f);
|
||||||
}
|
}
|
||||||
currentCameraRotation.Z = (float) Mathf.Lerp(currentCameraRotation.Z, cameraIncline, delta * CameraInclineAcceleration);
|
currentCameraRotation.Z = (float) Mathf.Lerp(currentCameraRotation.Z, cameraIncline, delta * CameraInclineAcceleration);
|
||||||
_cameraAnchor.Rotation = currentCameraRotation;
|
_cameraAnchor.Rotation = currentCameraRotation;
|
||||||
|
|
||||||
|
if (isSliding)
|
||||||
|
{
|
||||||
|
_cameraAnchor.Position = Vector3.Down*SlidingCameraHeightOffset;
|
||||||
|
float noise1D = _slidingNoise.GetNoise1D(Time.GetTicksMsec());
|
||||||
|
float noiseAmplitude = SlidingJitterAmplitude*Mathf.Clamp(playerVelocity.Length(), 0f, 1f);
|
||||||
|
_cameraAnchor.Position += Vector3.Up*noise1D*noiseAmplitude;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_cameraAnchor.Position = Vector3.Zero;
|
||||||
|
}
|
||||||
|
|
||||||
_camera.GlobalTransform = _cameraAnchor.GetGlobalTransformInterpolated();
|
_camera.GlobalTransform = _cameraAnchor.GetGlobalTransformInterpolated();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,10 +69,6 @@ transform = Transform3D(1, 0, 0, 0, 0.99999994, 0, 0, 0, 0.99999994, 0, 0, 0)
|
|||||||
current = true
|
current = true
|
||||||
fov = 90.0
|
fov = 90.0
|
||||||
|
|
||||||
[node name="RayCast3D" type="RayCast3D" parent="CameraSmooth/Camera3D"]
|
|
||||||
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, -1, 0, 1, -4.37114e-08, 0, 0, -0.64723)
|
|
||||||
visible = false
|
|
||||||
|
|
||||||
[node name="CameraAnchor" type="Marker3D" parent="."]
|
[node name="CameraAnchor" type="Marker3D" parent="."]
|
||||||
|
|
||||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||||
|
|||||||
@@ -1,4 +1,4 @@
|
|||||||
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=160 format=3 uid="uid://bl5crtu1gkrtr"]
|
[gd_resource type="Resource" script_class="GUIDEMappingContext" load_steps=161 format=3 uid="uid://bl5crtu1gkrtr"]
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://cpplm41b5bt6m" path="res://addons/guide/guide_action_mapping.gd" id="1_qmhk6"]
|
[ext_resource type="Script" uid="uid://cpplm41b5bt6m" path="res://addons/guide/guide_action_mapping.gd" id="1_qmhk6"]
|
||||||
[ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/base_mode/move.tres" id="2_g6bbx"]
|
[ext_resource type="Resource" uid="uid://htqvokm8mufq" path="res://systems/inputs/base_mode/move.tres" id="2_g6bbx"]
|
||||||
@@ -430,21 +430,25 @@ metadata/_guide_input_mappings_collapsed = false
|
|||||||
script = ExtResource("19_qkgmj")
|
script = ExtResource("19_qkgmj")
|
||||||
button = 2
|
button = 2
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_kxb2c"]
|
[sub_resource type="Resource" id="Resource_06f1o"]
|
||||||
script = ExtResource("15_fykw6")
|
script = ExtResource("15_g6bbx")
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_v2ywt"]
|
[sub_resource type="Resource" id="Resource_v2ywt"]
|
||||||
script = ExtResource("3_yp12v")
|
script = ExtResource("3_yp12v")
|
||||||
input = SubResource("Resource_o5yys")
|
input = SubResource("Resource_o5yys")
|
||||||
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_kxb2c")])
|
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_06f1o")])
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_qpgnj"]
|
[sub_resource type="Resource" id="Resource_qpgnj"]
|
||||||
script = ExtResource("30_cvxqo")
|
script = ExtResource("30_cvxqo")
|
||||||
key = 69
|
key = 69
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_g5tel"]
|
||||||
|
script = ExtResource("15_g6bbx")
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_s6d3g"]
|
[sub_resource type="Resource" id="Resource_s6d3g"]
|
||||||
script = ExtResource("3_yp12v")
|
script = ExtResource("3_yp12v")
|
||||||
input = SubResource("Resource_qpgnj")
|
input = SubResource("Resource_qpgnj")
|
||||||
|
triggers = Array[ExtResource("8_2tfaw")]([SubResource("Resource_g5tel")])
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_vtk18"]
|
[sub_resource type="Resource" id="Resource_vtk18"]
|
||||||
script = ExtResource("1_qmhk6")
|
script = ExtResource("1_qmhk6")
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ visible = false
|
|||||||
shape = SubResource("CapsuleShape3D_4coqe")
|
shape = SubResource("CapsuleShape3D_4coqe")
|
||||||
target_position = Vector3(0, 0, 0)
|
target_position = Vector3(0, 0, 0)
|
||||||
max_results = 1
|
max_results = 1
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
debug_shape_custom_color = Color(1, 0, 0, 1)
|
debug_shape_custom_color = Color(1, 0, 0, 1)
|
||||||
|
|
||||||
[node name="WallInFrontCast3D" type="ShapeCast3D" parent="."]
|
[node name="WallInFrontCast3D" type="ShapeCast3D" parent="."]
|
||||||
@@ -37,20 +37,20 @@ visible = false
|
|||||||
shape = SubResource("SphereShape3D_2oobp")
|
shape = SubResource("SphereShape3D_2oobp")
|
||||||
target_position = Vector3(0, 0, -1.5)
|
target_position = Vector3(0, 0, -1.5)
|
||||||
max_results = 1
|
max_results = 1
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
debug_shape_custom_color = Color(0.911631, 0.11884, 0.656218, 1)
|
debug_shape_custom_color = Color(0.911631, 0.11884, 0.656218, 1)
|
||||||
|
|
||||||
[node name="InAirWallDetect" type="ShapeCast3D" parent="."]
|
[node name="InAirWallDetect" type="ShapeCast3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.01, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.01, 0)
|
||||||
shape = SubResource("CapsuleShape3D_2oobp")
|
shape = SubResource("CapsuleShape3D_2oobp")
|
||||||
target_position = Vector3(0, 0, -2)
|
target_position = Vector3(0, 0, -2)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="GroundedWallDetect" type="ShapeCast3D" parent="."]
|
[node name="GroundedWallDetect" type="ShapeCast3D" parent="."]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.26, 0)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 1.26, 0)
|
||||||
shape = SubResource("CapsuleShape3D_i32qj")
|
shape = SubResource("CapsuleShape3D_i32qj")
|
||||||
target_position = Vector3(0, 0, -2)
|
target_position = Vector3(0, 0, -2)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="WallProfileShapeCasts" type="Node3D" parent="."]
|
[node name="WallProfileShapeCasts" type="Node3D" parent="."]
|
||||||
|
|
||||||
@@ -59,46 +59,46 @@ transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.5)
|
|||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.125, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="ShapeCast2" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast2" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.75)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -0.75)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.125, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="ShapeCast3" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast3" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.125, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="ShapeCast4" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast4" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.25)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.25)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.125, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="ShapeCast5" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast5" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.5)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.125, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="ShapeCast6" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast6" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.75)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -1.75)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.125, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|
||||||
[node name="ShapeCast7" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
[node name="ShapeCast7" type="ShapeCast3D" parent="WallProfileShapeCasts"]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -2)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 2.5, -2)
|
||||||
enabled = false
|
enabled = false
|
||||||
shape = SubResource("SphereShape3D_i32qj")
|
shape = SubResource("SphereShape3D_i32qj")
|
||||||
target_position = Vector3(0, -2.125, 0)
|
target_position = Vector3(0, -2.125, 0)
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
|
|||||||
@@ -1,221 +0,0 @@
|
|||||||
using Godot;
|
|
||||||
using Movementtests.player_controller.Scripts;
|
|
||||||
using RustyOptions;
|
|
||||||
|
|
||||||
namespace Movementtests.systems;
|
|
||||||
|
|
||||||
public partial class MoveSystem : Node3D
|
|
||||||
{
|
|
||||||
public enum JumpTypes
|
|
||||||
{
|
|
||||||
SimpleJump,
|
|
||||||
DoubleJump,
|
|
||||||
JumpFromDash,
|
|
||||||
JumpFromWall
|
|
||||||
}
|
|
||||||
|
|
||||||
public record MoveSystemParameters(
|
|
||||||
CharacterBody3D Parent,
|
|
||||||
Gravity Gravity,
|
|
||||||
MantleSystem MantleSystem,
|
|
||||||
TweenQueueSystem TweenQueueSystem,
|
|
||||||
HeadSystem HeadSystem,
|
|
||||||
CapsuleCollider CapsuleCollider);
|
|
||||||
|
|
||||||
public record MoveAroundParameters(
|
|
||||||
double Delta,
|
|
||||||
Vector3 MovementDirection,
|
|
||||||
bool IsOnFloor,
|
|
||||||
bool IsDead,
|
|
||||||
bool IsHeadTouchingCeiling,
|
|
||||||
bool isHanging,
|
|
||||||
bool isWallHugging
|
|
||||||
);
|
|
||||||
|
|
||||||
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
|
||||||
public float WalkSpeed { get; set; } = 5.0f;
|
|
||||||
[Export(PropertyHint.Range, "0,20,0.1,or_greater")]
|
|
||||||
public float SprintSpeed { get; set; } = 7.2f;
|
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
|
||||||
public float CrouchSpeed { get; set; } = 2.5f;
|
|
||||||
[Export(PropertyHint.Range, "0,100,0.1,or_greater")]
|
|
||||||
|
|
||||||
public float _currentSpeed;
|
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
|
||||||
public float AccelerationSpeedFactorFloor = 5.0f;
|
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
|
||||||
public float DecelerationSpeedFactorFloor = 5.0f;
|
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
|
||||||
public float DecelerationSpeedFactorAir = 1.0f;
|
|
||||||
[Export(PropertyHint.Range, "0,1,0.01,or_greater")]
|
|
||||||
public float ApexHoldTime = 0.0f;
|
|
||||||
private float _timeLeftAtApex = 0.0f;
|
|
||||||
private bool _wasGoingUpLastFrame = false;
|
|
||||||
|
|
||||||
public float CrouchTransitionSpeed { get; set; } = 20.0f;
|
|
||||||
[Export(PropertyHint.Range, "0,5,0.1,or_greater")]
|
|
||||||
public float WallHugGravityReducingFactor { get; set; } = 0.1f;
|
|
||||||
|
|
||||||
|
|
||||||
private Gravity _gravity;
|
|
||||||
private CharacterBody3D _parent;
|
|
||||||
private MantleSystem _mantleSystem;
|
|
||||||
private TweenQueueSystem _tweenQueueSystem;
|
|
||||||
private CapsuleCollider _capsuleCollider;
|
|
||||||
private HeadSystem _headSystem;
|
|
||||||
public void Init(MoveSystemParameters parameters)
|
|
||||||
{
|
|
||||||
_parent = parameters.Parent;
|
|
||||||
_gravity = parameters.Gravity;
|
|
||||||
_mantleSystem = parameters.MantleSystem;
|
|
||||||
_tweenQueueSystem = parameters.TweenQueueSystem;
|
|
||||||
_capsuleCollider = parameters.CapsuleCollider;
|
|
||||||
_headSystem = parameters.HeadSystem;
|
|
||||||
|
|
||||||
_currentSpeed = WalkSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
private bool IsGoingUp()
|
|
||||||
{
|
|
||||||
return _parent.Velocity.Y > 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void MoveAround(MoveAroundParameters param)
|
|
||||||
{
|
|
||||||
var (delta, movementDirection, isOnFloor, isDead, isHeadTouchingCeiling, isHanging, isWallHugging) = param;
|
|
||||||
|
|
||||||
var doesCapsuleHaveCrouchingHeight = _capsuleCollider.IsCrouchingHeight();
|
|
||||||
var doesCapsuleHaveDefaultHeight = _capsuleCollider.IsDefaultHeight();
|
|
||||||
|
|
||||||
if (IsGoingUp() || isOnFloor)
|
|
||||||
{
|
|
||||||
_wasGoingUpLastFrame = true;
|
|
||||||
_timeLeftAtApex = ApexHoldTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isHanging)
|
|
||||||
{
|
|
||||||
_parent.Velocity = Vector3.Zero;
|
|
||||||
_parent.MoveAndSlide();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
if (isWallHugging)
|
|
||||||
{
|
|
||||||
_parent.Velocity = new Vector3(
|
|
||||||
x: _parent.Velocity.X,
|
|
||||||
y: _parent.Velocity.Y - _gravity.CalculateGravityForce() * (float)delta * WallHugGravityReducingFactor,
|
|
||||||
z: _parent.Velocity.Z);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Adding the gravity
|
|
||||||
if (!isOnFloor)
|
|
||||||
{
|
|
||||||
if (!IsGoingUp() && _wasGoingUpLastFrame && _timeLeftAtApex > 0)
|
|
||||||
{
|
|
||||||
_parent.Velocity = new Vector3(
|
|
||||||
x: _parent.Velocity.X,
|
|
||||||
y: 0,
|
|
||||||
z: _parent.Velocity.Z);
|
|
||||||
_timeLeftAtApex -= (float) delta;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_parent.Velocity = new Vector3(
|
|
||||||
x: _parent.Velocity.X,
|
|
||||||
y: _parent.Velocity.Y - (_gravity.CalculateGravityForce() * (float)delta),
|
|
||||||
z: _parent.Velocity.Z);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// The code below is required to quickly adjust player's position on Y-axis when there's a ceiling on the
|
|
||||||
// trajectory of player's jump and player is standing
|
|
||||||
if (isHeadTouchingCeiling && doesCapsuleHaveDefaultHeight)
|
|
||||||
{
|
|
||||||
_parent.Velocity = new Vector3(
|
|
||||||
x: _parent.Velocity.X,
|
|
||||||
y: _parent.Velocity.Y - 2.0f,
|
|
||||||
z: _parent.Velocity.Z);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!isDead)
|
|
||||||
{
|
|
||||||
|
|
||||||
// Used both for detecting the moment when we enter into crouching mode and the moment when we're already
|
|
||||||
// in the crouching mode
|
|
||||||
if (Input.IsActionPressed("crouch") ||
|
|
||||||
(doesCapsuleHaveCrouchingHeight && isHeadTouchingCeiling))
|
|
||||||
{
|
|
||||||
_capsuleCollider.Crouch((float)delta, CrouchTransitionSpeed);
|
|
||||||
_currentSpeed = CrouchSpeed;
|
|
||||||
}
|
|
||||||
// Used both for the moment when we exit the crouching mode and for the moment when we just walk
|
|
||||||
else
|
|
||||||
{
|
|
||||||
_capsuleCollider.UndoCrouching((float)delta, CrouchTransitionSpeed);
|
|
||||||
_currentSpeed = WalkSpeed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Each component of the boolean statement for sprinting is required
|
|
||||||
if (Input.IsActionPressed("sprint") && !isHeadTouchingCeiling &&
|
|
||||||
!doesCapsuleHaveCrouchingHeight && !isDead)
|
|
||||||
{
|
|
||||||
_currentSpeed = SprintSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Basis is a 3x4 matrix. It contains information about scaling and rotation of head.
|
|
||||||
// By multiplying our Vector3 by this matrix we're doing multiple things:
|
|
||||||
// a) We start to operate in global space;
|
|
||||||
// b) We're applying to Vector3 the current rotation of "head" object;
|
|
||||||
// c) We're applying to Vector3 the current scaling of "head" object;
|
|
||||||
Vector3 direction = _headSystem.Transform.Basis * movementDirection;
|
|
||||||
|
|
||||||
if (isDead)
|
|
||||||
{
|
|
||||||
direction = Vector3.Zero;
|
|
||||||
}
|
|
||||||
|
|
||||||
var accelerationFloorFactor = direction.Length() > 0 ? AccelerationSpeedFactorFloor : DecelerationSpeedFactorFloor;
|
|
||||||
var accelerationFactor = isOnFloor ? accelerationFloorFactor : DecelerationSpeedFactorAir;
|
|
||||||
|
|
||||||
float xAcceleration = Mathf.Lerp(_parent.Velocity.X, direction.X * _currentSpeed,
|
|
||||||
(float)delta * accelerationFactor);
|
|
||||||
float zAcceleration = Mathf.Lerp(_parent.Velocity.Z, direction.Z * _currentSpeed,
|
|
||||||
(float)delta * accelerationFactor);
|
|
||||||
_parent.Velocity = new Vector3(xAcceleration, _parent.Velocity.Y, zAcceleration);
|
|
||||||
|
|
||||||
if (isDead)
|
|
||||||
{
|
|
||||||
_parent.MoveAndSlide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void Jump(JumpTypes jumpType, Vector3? jumpDirection = null, float boost = 1.0f)
|
|
||||||
{
|
|
||||||
var effectiveJumpDirection = jumpDirection ?? Vector3.Up;
|
|
||||||
var jumpForce = 0.0f;
|
|
||||||
switch (jumpType)
|
|
||||||
{
|
|
||||||
case JumpTypes.DoubleJump:
|
|
||||||
jumpForce = _gravity.CalculateDoubleJumpForce();
|
|
||||||
break;
|
|
||||||
case JumpTypes.SimpleJump:
|
|
||||||
jumpForce = _gravity.CalculateJumpForce();
|
|
||||||
break;
|
|
||||||
case JumpTypes.JumpFromDash:
|
|
||||||
jumpForce = _gravity.CalculateJumpFromDashForce();
|
|
||||||
break;
|
|
||||||
case JumpTypes.JumpFromWall:
|
|
||||||
jumpForce = _gravity.CalculateJumpFromWallForce();
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
jumpForce = _gravity.CalculateJumpForce();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
var currentHorizontalVelocity = new Vector3(_parent.Velocity.X, 0, _parent.Velocity.Z);
|
|
||||||
var jumpVelocity = jumpForce * effectiveJumpDirection * boost;
|
|
||||||
_parent.Velocity = currentHorizontalVelocity + jumpVelocity;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://dyy5njw6pxoh4
|
|
||||||
@@ -1,5 +0,0 @@
|
|||||||
[gd_resource type="Curve" format=3 uid="uid://buxwd3wd0nln5"]
|
|
||||||
|
|
||||||
[resource]
|
|
||||||
_data = [Vector2(0, 0), 0.0, 3.01651, 0, 0, Vector2(0.996169, 1), 0.0, 0.0, 0, 0]
|
|
||||||
point_count = 2
|
|
||||||
@@ -40,7 +40,7 @@ public partial class WallHugSystem : Node3D
|
|||||||
{
|
{
|
||||||
foreach (RayCast3D raycast in _raycasts)
|
foreach (RayCast3D raycast in _raycasts)
|
||||||
{
|
{
|
||||||
if (raycast.IsColliding())
|
if (raycast.IsColliding() && Math.Abs(raycast.GetCollisionNormal().Y) < 0.3f)
|
||||||
{
|
{
|
||||||
WallHugLocation = raycast.GetCollisionPoint().Some();
|
WallHugLocation = raycast.GetCollisionPoint().Some();
|
||||||
WallHugNormal = raycast.GetCollisionNormal().Some();
|
WallHugNormal = raycast.GetCollisionNormal().Some();
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ stencil_outline_thickness = 0.1
|
|||||||
material = SubResource("StandardMaterial3D_m0v1h")
|
material = SubResource("StandardMaterial3D_m0v1h")
|
||||||
|
|
||||||
[node name="Weapon" type="RigidBody3D"]
|
[node name="Weapon" type="RigidBody3D"]
|
||||||
collision_layer = 4
|
collision_layer = 65536
|
||||||
collision_mask = 2
|
collision_mask = 256
|
||||||
continuous_cd = true
|
continuous_cd = true
|
||||||
contact_monitor = true
|
contact_monitor = true
|
||||||
max_contacts_reported = 1
|
max_contacts_reported = 1
|
||||||
|
|||||||
Reference in New Issue
Block a user