Compare commits
10 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 7c74b8b5e5 | |||
| f7705a6d57 | |||
| 0dcf4a3f99 | |||
| 4ccdbc0ee6 | |||
| 0436053c62 | |||
| 6b97c226f1 | |||
| b1e78df6c7 | |||
| 5908494977 | |||
| 63529a11ae | |||
| 255b87f991 |
@@ -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>
|
||||||
9
interfaces/IDamageMaker.cs
Normal file
9
interfaces/IDamageMaker.cs
Normal file
@@ -0,0 +1,9 @@
|
|||||||
|
using Godot;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IDamageMaker
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
RDamage GetDamageDealt { get; set; }
|
||||||
|
}
|
||||||
1
interfaces/IDamageMaker.cs.uid
Normal file
1
interfaces/IDamageMaker.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://wdqo51131g5
|
||||||
8
interfaces/IDamageable.cs
Normal file
8
interfaces/IDamageable.cs
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
using System;
|
||||||
|
|
||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IDamageable
|
||||||
|
{
|
||||||
|
float TakeDamage(RDamage damage);
|
||||||
|
}
|
||||||
1
interfaces/IDamageable.cs.uid
Normal file
1
interfaces/IDamageable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cf56b2ep3bu3j
|
||||||
6
interfaces/IHealthable.cs
Normal file
6
interfaces/IHealthable.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IHealthable
|
||||||
|
{
|
||||||
|
void ReduceHealth(float amount);
|
||||||
|
}
|
||||||
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();
|
||||||
|
}
|
||||||
1
interfaces/IKillable.cs.uid
Normal file
1
interfaces/IKillable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dqpjr2d01sk1a
|
||||||
6
interfaces/IKnockbackable.cs
Normal file
6
interfaces/IKnockbackable.cs
Normal file
@@ -0,0 +1,6 @@
|
|||||||
|
namespace Movementtests.interfaces;
|
||||||
|
|
||||||
|
public interface IKnockbackable
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
1
interfaces/IKnockbackable.cs.uid
Normal file
1
interfaces/IKnockbackable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bh06s1yefucf7
|
||||||
15
interfaces/IMoveable.cs
Normal file
15
interfaces/IMoveable.cs
Normal file
@@ -0,0 +1,15 @@
|
|||||||
|
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
|
||||||
|
{
|
||||||
|
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 TestMethod();
|
||||||
|
}
|
||||||
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
|
||||||
@@ -1,9 +1,15 @@
|
|||||||
[gd_scene load_steps=11 format=3 uid="uid://q7uc1h2jpbd2"]
|
[gd_scene load_steps=10 format=3 uid="uid://q7uc1h2jpbd2"]
|
||||||
|
|
||||||
[ext_resource type="PackedScene" uid="uid://bei4nhkf8lwdo" path="res://player_controller/PlayerController.tscn" id="1_62kkh"]
|
[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="Material" uid="uid://31aulub2nqov" path="res://assets/greybox/m_greybox.tres" id="2_3uydm"]
|
||||||
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/first_enemy.tscn" id="3_3uydm"]
|
[ext_resource type="Script" uid="uid://jitubgv6judn" path="res://resource_definitions/RDamage.cs" id="2_sysok"]
|
||||||
[ext_resource type="Script" uid="uid://b2vdwkiqauhk3" path="res://scenes/enemies/EnemyInitInputs.cs" id="4_nd7vd"]
|
[ext_resource type="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/first_enemy/first_enemy.tscn" id="3_3uydm"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://cmlud1hwkd6sv" path="res://scenes/enemies/flying_enemy/flying_enemy.tscn" id="5_8fd2t"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_gp7s3"]
|
||||||
|
script = ExtResource("2_sysok")
|
||||||
|
DamageDealt = 3.0
|
||||||
|
metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||||
|
|
||||||
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_0xm2m"]
|
[sub_resource type="ProceduralSkyMaterial" id="ProceduralSkyMaterial_0xm2m"]
|
||||||
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
sky_horizon_color = Color(0.662243, 0.671743, 0.686743, 1)
|
||||||
@@ -27,26 +33,12 @@ ssil_radius = 8.4
|
|||||||
sdfgi_use_occlusion = true
|
sdfgi_use_occlusion = true
|
||||||
glow_enabled = true
|
glow_enabled = true
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_8fd2t"]
|
|
||||||
script = ExtResource("4_nd7vd")
|
|
||||||
Speed = 3.2
|
|
||||||
metadata/_custom_type_script = "uid://b2vdwkiqauhk3"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_7m3bq"]
|
|
||||||
script = ExtResource("4_nd7vd")
|
|
||||||
Speed = 2.8
|
|
||||||
metadata/_custom_type_script = "uid://b2vdwkiqauhk3"
|
|
||||||
|
|
||||||
[sub_resource type="Resource" id="Resource_sysok"]
|
|
||||||
script = ExtResource("4_nd7vd")
|
|
||||||
Speed = 6.4
|
|
||||||
metadata/_custom_type_script = "uid://b2vdwkiqauhk3"
|
|
||||||
|
|
||||||
[node name="Main" type="Node3D"]
|
[node name="Main" type="Node3D"]
|
||||||
|
|
||||||
[node name="Player" parent="." instance=ExtResource("1_62kkh")]
|
[node name="Player" parent="." instance=ExtResource("1_62kkh")]
|
||||||
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 7.5)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 1, 1, 7.5)
|
||||||
TutorialDone = true
|
TutorialDone = true
|
||||||
|
GetDamageDealt = SubResource("Resource_gp7s3")
|
||||||
|
|
||||||
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
[node name="WorldEnvironment" type="WorldEnvironment" parent="."]
|
||||||
environment = SubResource("Environment_1bvp3")
|
environment = SubResource("Environment_1bvp3")
|
||||||
@@ -111,14 +103,19 @@ material = ExtResource("2_3uydm")
|
|||||||
[node name="Enemy" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_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)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, -16.83681)
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
Inputs = SubResource("Resource_8fd2t")
|
|
||||||
|
|
||||||
[node name="Enemy2" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_3uydm")]
|
[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)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, -3, 0, -16.83681)
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
Inputs = SubResource("Resource_7m3bq")
|
|
||||||
|
|
||||||
[node name="Enemy3" parent="." node_paths=PackedStringArray("Target") instance=ExtResource("3_3uydm")]
|
[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)
|
transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 2.5, 0, -16.83681)
|
||||||
Target = NodePath("../Player")
|
Target = NodePath("../Player")
|
||||||
Inputs = SubResource("Resource_sysok")
|
|
||||||
|
[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")
|
||||||
|
|||||||
@@ -1,10 +1,13 @@
|
|||||||
[gd_scene load_steps=50 format=3 uid="uid://bei4nhkf8lwdo"]
|
[gd_scene load_steps=56 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="Script" uid="uid://jitubgv6judn" path="res://resource_definitions/RDamage.cs" id="2_q14ux"]
|
||||||
[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://scenes/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://resource_definitions/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"]
|
||||||
@@ -43,12 +46,25 @@
|
|||||||
[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_m8gvy"]
|
||||||
|
script = ExtResource("2_q14ux")
|
||||||
|
DamageDealt = 3.0
|
||||||
|
metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||||
|
|
||||||
|
[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"]
|
[sub_resource type="SphereShape3D" id="SphereShape3D_6lejt"]
|
||||||
radius = 0.45
|
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)
|
||||||
@@ -69,9 +85,11 @@ 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
|
collision_mask = 272
|
||||||
script = ExtResource("1_poq2x")
|
script = ExtResource("1_poq2x")
|
||||||
|
GetDamageDealt = SubResource("Resource_m8gvy")
|
||||||
|
CDamage = NodePath("CDamageable")
|
||||||
WalkSpeed = 7.5
|
WalkSpeed = 7.5
|
||||||
AccelerationFloor = 4.0
|
AccelerationFloor = 4.0
|
||||||
DecelerationFloor = 3.0
|
DecelerationFloor = 3.0
|
||||||
@@ -109,6 +127,11 @@ WallHugGravityLesseningFactor = 15.0
|
|||||||
WallHugDownwardMaxSpeed = 4.0
|
WallHugDownwardMaxSpeed = 4.0
|
||||||
WallHugHorizontalDeceleration = 1.0
|
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)
|
||||||
@@ -164,6 +187,17 @@ 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")
|
||||||
|
|
||||||
|
|||||||
@@ -2,11 +2,12 @@ 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, IKnockbackable, IDamageMaker
|
||||||
{
|
{
|
||||||
// Enums
|
// Enums
|
||||||
public enum AllowedInputs
|
public enum AllowedInputs
|
||||||
@@ -28,6 +29,10 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
}
|
}
|
||||||
private BufferedActions _bufferedAction = BufferedActions.None;
|
private BufferedActions _bufferedAction = BufferedActions.None;
|
||||||
|
|
||||||
|
///////////////////////////
|
||||||
|
// Signals and events //
|
||||||
|
///////////////////////////
|
||||||
|
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
// Public stuff //
|
// Public stuff //
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -52,11 +57,19 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
public ShapeCast3D GroundDetector;
|
public ShapeCast3D GroundDetector;
|
||||||
public ShapeCast3D CeilingDetector;
|
public ShapeCast3D CeilingDetector;
|
||||||
public RayCast3D DirectGroundDetector;
|
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 GetDamageDealt { 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")]
|
||||||
@@ -353,6 +366,8 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
var playerShape = StandingCollider.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"));
|
||||||
@@ -1567,17 +1582,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 ///////
|
||||||
///////////////////////////
|
///////////////////////////
|
||||||
@@ -1728,4 +1732,28 @@ public partial class PlayerController : CharacterBody3D
|
|||||||
DashIndicatorNode.LookAt(WeaponSystem.GlobalPosition);
|
DashIndicatorNode.LookAt(WeaponSystem.GlobalPosition);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public float TakeDamage(RDamage damage)
|
||||||
|
{
|
||||||
|
return CDamage.TakeDamage(damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////
|
||||||
|
// 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(GetDamageDealt);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
24
resource_definitions/RDamage.cs
Normal file
24
resource_definitions/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
resource_definitions/RDamage.cs.uid
Normal file
1
resource_definitions/RDamage.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://jitubgv6judn
|
||||||
31
resource_definitions/RDamageModifier.cs
Normal file
31
resource_definitions/RDamageModifier.cs
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
using Movementtests.systems.damage;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RDamageModifier : Resource, IDamageable
|
||||||
|
{
|
||||||
|
[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 float TakeDamage(RDamage damage)
|
||||||
|
{
|
||||||
|
if (damage.DamageType != DamageType) return 0;
|
||||||
|
var finalDamage = damage.DamageDealt * Modifier;
|
||||||
|
return finalDamage;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
resource_definitions/RDamageModifier.cs.uid
Normal file
1
resource_definitions/RDamageModifier.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b6y3ugfydvch0
|
||||||
12
resource_definitions/RDeathEffect.cs
Normal file
12
resource_definitions/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()
|
||||||
|
{
|
||||||
|
GD.Print("Death Effect triggered");
|
||||||
|
}
|
||||||
|
}
|
||||||
1
resource_definitions/RDeathEffect.cs.uid
Normal file
1
resource_definitions/RDeathEffect.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b4cwruitopcee
|
||||||
20
resource_definitions/RHealth.cs
Normal file
20
resource_definitions/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
resource_definitions/RHealth.cs.uid
Normal file
1
resource_definitions/RHealth.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://baiapod3csndf
|
||||||
23
resource_definitions/RMovement.cs
Normal file
23
resource_definitions/RMovement.cs
Normal file
@@ -0,0 +1,23 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class RMovement : Resource
|
||||||
|
{
|
||||||
|
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
||||||
|
public float Speed;
|
||||||
|
|
||||||
|
[Export(PropertyHint.Range, "0,20,1,or_greater")]
|
||||||
|
public float TargetHeight;
|
||||||
|
|
||||||
|
public RMovement()
|
||||||
|
{
|
||||||
|
Speed = 3.0f;
|
||||||
|
TargetHeight = 10.0f;
|
||||||
|
}
|
||||||
|
public RMovement(float speed, float targetHeight)
|
||||||
|
{
|
||||||
|
Speed = speed;
|
||||||
|
TargetHeight = targetHeight;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
resource_definitions/RMovement.cs.uid
Normal file
1
resource_definitions/RMovement.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://dtpxijlnb2c5
|
||||||
22
scenes/damage/CDamageable.cs
Normal file
22
scenes/damage/CDamageable.cs
Normal file
@@ -0,0 +1,22 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class CDamageable : Node, IDamageable
|
||||||
|
{
|
||||||
|
[Signal]
|
||||||
|
public delegate void DamageTakenEventHandler(float damageTaken);
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RDamageModifier[] DamageModifiers { get; set; }
|
||||||
|
|
||||||
|
public float TakeDamage(RDamage damage)
|
||||||
|
{
|
||||||
|
var finalDamage = 0f;
|
||||||
|
foreach (var damageable in DamageModifiers.ToIDamageables())
|
||||||
|
finalDamage += damageable.TakeDamage(damage);
|
||||||
|
EmitSignalDamageTaken(finalDamage);
|
||||||
|
return finalDamage;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scenes/damage/CDamageable.cs.uid
Normal file
1
scenes/damage/CDamageable.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://b0u23nkpaimyc
|
||||||
6
scenes/damage/CDamageable.tscn
Normal file
6
scenes/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://scenes/damage/CDamageable.cs" id="1_qp8bd"]
|
||||||
|
|
||||||
|
[node name="CDamageable" type="Node"]
|
||||||
|
script = ExtResource("1_qp8bd")
|
||||||
79
scenes/enemies/Enemy.cs
Normal file
79
scenes/enemies/Enemy.cs
Normal file
@@ -0,0 +1,79 @@
|
|||||||
|
using Godot;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class Enemy : CharacterBody3D, IDamageable, IDamageMaker, IHealthable, IKillable
|
||||||
|
{
|
||||||
|
[Export]
|
||||||
|
public Node3D Target { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RDamage GetDamageDealt { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public CHealth CHealth { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public CDamageable CDamage { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Node CMovement { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RDeathEffect[] DeathEffects { get; set; }
|
||||||
|
|
||||||
|
private Area3D _damageBox;
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
_damageBox = GetNode<Area3D>("DamageBox");
|
||||||
|
|
||||||
|
_damageBox.BodyEntered += OnDamageBoxTriggered;
|
||||||
|
CDamage.DamageTaken += ReduceHealth;
|
||||||
|
CHealth.Dead += Kill;
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void _PhysicsProcess(double delta)
|
||||||
|
{
|
||||||
|
var targetPlanar = new Vector3(Target.GlobalPosition.X, GlobalPosition.Y, Target.GlobalPosition.Z);
|
||||||
|
LookAt(targetPlanar);
|
||||||
|
|
||||||
|
if (CMovement is not IMoveable movement) return;
|
||||||
|
|
||||||
|
var inputs = new MovementInputs(
|
||||||
|
Velocity: Velocity,
|
||||||
|
TargetLocation: Target.GlobalPosition,
|
||||||
|
isOnFloor: IsOnFloor(),
|
||||||
|
gravity: GetGravity(),
|
||||||
|
delta: delta
|
||||||
|
);
|
||||||
|
Velocity = movement!.ComputeVelocity(inputs);
|
||||||
|
MoveAndSlide();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnDamageBoxTriggered(Node3D body)
|
||||||
|
{
|
||||||
|
GD.Print("Take this!");
|
||||||
|
if(body is IDamageable damageable) damageable.TakeDamage(GetDamageDealt);
|
||||||
|
}
|
||||||
|
|
||||||
|
public float TakeDamage(RDamage damage)
|
||||||
|
{
|
||||||
|
GD.Print("Ouch!");
|
||||||
|
return CDamage.TakeDamage(damage);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReduceHealth(float amount)
|
||||||
|
{
|
||||||
|
CHealth.ReduceHealth(amount);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Kill()
|
||||||
|
{
|
||||||
|
foreach (var killable in DeathEffects.ToIKillables())
|
||||||
|
{
|
||||||
|
killable.Kill();
|
||||||
|
}
|
||||||
|
QueueFree();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
using Godot;
|
|
||||||
using System;
|
|
||||||
|
|
||||||
[GlobalClass]
|
|
||||||
public partial class EnemyInitInputs : Resource
|
|
||||||
{
|
|
||||||
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
|
|
||||||
public float Speed = 5.0f;
|
|
||||||
|
|
||||||
public EnemyInitInputs()
|
|
||||||
{
|
|
||||||
Speed = 5.0f;
|
|
||||||
}
|
|
||||||
public EnemyInitInputs(float speed)
|
|
||||||
{
|
|
||||||
Speed = speed;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
uid://b2vdwkiqauhk3
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
using Godot;
|
|
||||||
using System;
|
|
||||||
using Movementtests.player_controller.Scripts;
|
|
||||||
|
|
||||||
public partial class FirstEnemy : CharacterBody3D
|
|
||||||
{
|
|
||||||
[Export]
|
|
||||||
public Node3D Target { get; set; }
|
|
||||||
|
|
||||||
[Export]
|
|
||||||
public EnemyInitInputs Inputs;
|
|
||||||
|
|
||||||
private RayCast3D _wallInFrontRayCast;
|
|
||||||
|
|
||||||
public override void _Ready()
|
|
||||||
{
|
|
||||||
_wallInFrontRayCast = GetNode<RayCast3D>("WallInFrontRayCast");
|
|
||||||
}
|
|
||||||
|
|
||||||
public override void _PhysicsProcess(double delta)
|
|
||||||
{
|
|
||||||
var target = Target.GlobalPosition;
|
|
||||||
var direction = (target - GlobalPosition).Normalized();
|
|
||||||
|
|
||||||
var targetPlane = new Vector3(target.X, GlobalPosition.Y, target.Z);
|
|
||||||
LookAt(targetPlane);
|
|
||||||
|
|
||||||
var velocity = Velocity;
|
|
||||||
velocity.X = direction.X * Inputs.Speed;
|
|
||||||
velocity.Z = direction.Z * Inputs.Speed;
|
|
||||||
|
|
||||||
if (_wallInFrontRayCast.IsColliding())
|
|
||||||
velocity.Y = Inputs.Speed;
|
|
||||||
else if (!IsOnFloor())
|
|
||||||
velocity += GetGravity() * (float)delta;
|
|
||||||
|
|
||||||
Velocity = velocity;
|
|
||||||
MoveAndSlide();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
[gd_scene load_steps=6 format=3 uid="uid://dxt0e2ugmttqq"]
|
|
||||||
|
|
||||||
[ext_resource type="Script" uid="uid://bn7sc6id7n166" path="res://scenes/enemies/FirstEnemy.cs" id="1_4yfjf"]
|
|
||||||
|
|
||||||
[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)
|
|
||||||
|
|
||||||
[node name="CharacterBody3D" type="CharacterBody3D"]
|
|
||||||
collision_layer = 16
|
|
||||||
collision_mask = 273
|
|
||||||
script = ExtResource("1_4yfjf")
|
|
||||||
|
|
||||||
[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
|
|
||||||
101
scenes/enemies/first_enemy/first_enemy.tscn
Normal file
101
scenes/enemies/first_enemy/first_enemy.tscn
Normal file
@@ -0,0 +1,101 @@
|
|||||||
|
[gd_scene load_steps=17 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/first_enemy/first_enemy_damage.tres" id="2_6d4gl"]
|
||||||
|
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://scenes/health/CHealth.cs" id="2_gsmti"]
|
||||||
|
[ext_resource type="Script" uid="uid://b6y3ugfydvch0" path="res://resource_definitions/RDamageModifier.cs" id="2_r3cnf"]
|
||||||
|
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://resource_definitions/RHealth.cs" id="3_pvbr4"]
|
||||||
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/damage/CDamageable.cs" id="7_1tw73"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dbr7ioio158ew" path="res://scenes/movement/CGroundedMovement.tscn" id="7_qyswd"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://resource_definitions/RMovement.cs" id="8_6d4gl"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_r3cnf"]
|
||||||
|
script = ExtResource("3_pvbr4")
|
||||||
|
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_qj0ob"]
|
||||||
|
script = ExtResource("2_r3cnf")
|
||||||
|
metadata/_custom_type_script = "uid://b6y3ugfydvch0"
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_s01ng"]
|
||||||
|
script = ExtResource("8_6d4gl")
|
||||||
|
Speed = 3.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="FirstEnemy" type="CharacterBody3D" node_paths=PackedStringArray("CHealth", "CDamage", "CMovement")]
|
||||||
|
collision_layer = 16
|
||||||
|
collision_mask = 273
|
||||||
|
script = ExtResource("1_r6506")
|
||||||
|
GetDamageDealt = ExtResource("2_6d4gl")
|
||||||
|
CHealth = NodePath("CHealth")
|
||||||
|
CDamage = NodePath("CDamageable")
|
||||||
|
CMovement = NodePath("CGroundedMovement")
|
||||||
|
DeathEffects = Array[Object]([])
|
||||||
|
|
||||||
|
[node name="CHealth" type="Node" parent="."]
|
||||||
|
script = ExtResource("2_gsmti")
|
||||||
|
HealthResource = SubResource("Resource_r3cnf")
|
||||||
|
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_s01ng")
|
||||||
|
WallInFrontRayCast = NodePath("../WallInFrontRayCast")
|
||||||
|
|
||||||
|
[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/first_enemy/first_enemy_damage.tres
Normal file
8
scenes/enemies/first_enemy/first_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://resource_definitions/RDamage.cs" id="1_y415a"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_y415a")
|
||||||
|
DamageDealt = 2.0
|
||||||
|
metadata/_custom_type_script = "uid://jitubgv6judn"
|
||||||
7
scenes/enemies/first_enemy/first_enemy_health.tres
Normal file
7
scenes/enemies/first_enemy/first_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://resource_definitions/RHealth.cs" id="1_h6jgd"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_h6jgd")
|
||||||
|
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||||
106
scenes/enemies/flying_enemy/flying_enemy.tscn
Normal file
106
scenes/enemies/flying_enemy/flying_enemy.tscn
Normal file
@@ -0,0 +1,106 @@
|
|||||||
|
[gd_scene load_steps=18 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://resource_definitions/RDamageModifier.cs" id="2_1bsgx"]
|
||||||
|
[ext_resource type="Resource" uid="uid://dgo65k2ceqfvy" path="res://scenes/enemies/flying_enemy/flying_enemy_damage.tres" id="2_on7rt"]
|
||||||
|
[ext_resource type="Script" uid="uid://bjwrpv3jpsc1e" path="res://scenes/health/CHealth.cs" id="4_ys4jv"]
|
||||||
|
[ext_resource type="Script" uid="uid://baiapod3csndf" path="res://resource_definitions/RHealth.cs" id="5_irbqc"]
|
||||||
|
[ext_resource type="PackedScene" uid="uid://dmw5ibwrb483f" path="res://scenes/movement/CFlyingMovement.tscn" id="7_vaeds"]
|
||||||
|
[ext_resource type="Script" uid="uid://dtpxijlnb2c5" path="res://resource_definitions/RMovement.cs" id="8_on7rt"]
|
||||||
|
[ext_resource type="Script" uid="uid://b0u23nkpaimyc" path="res://scenes/damage/CDamageable.cs" id="8_uotso"]
|
||||||
|
|
||||||
|
[sub_resource type="Resource" id="Resource_aarbi"]
|
||||||
|
script = ExtResource("5_irbqc")
|
||||||
|
StartingHealth = 50.0
|
||||||
|
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||||
|
|
||||||
|
[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_ma2bq"]
|
||||||
|
script = ExtResource("8_on7rt")
|
||||||
|
Speed = 2.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", "CMovement")]
|
||||||
|
collision_layer = 16
|
||||||
|
collision_mask = 273
|
||||||
|
motion_mode = 1
|
||||||
|
script = ExtResource("1_q8l7o")
|
||||||
|
GetDamageDealt = ExtResource("2_on7rt")
|
||||||
|
CHealth = NodePath("CHealth")
|
||||||
|
CDamage = NodePath("CDamageable")
|
||||||
|
CMovement = NodePath("CFlyingMovement")
|
||||||
|
DeathEffects = Array[Object]([])
|
||||||
|
|
||||||
|
[node name="CHealth" type="Node" parent="."]
|
||||||
|
script = ExtResource("4_ys4jv")
|
||||||
|
HealthResource = SubResource("Resource_aarbi")
|
||||||
|
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_ma2bq")
|
||||||
|
TerrainCollision = 256
|
||||||
|
|
||||||
|
[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://resource_definitions/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://resource_definitions/RHealth.cs" id="1_jht15"]
|
||||||
|
|
||||||
|
[resource]
|
||||||
|
script = ExtResource("1_jht15")
|
||||||
|
StartingHealth = 50.0
|
||||||
|
metadata/_custom_type_script = "uid://baiapod3csndf"
|
||||||
34
scenes/health/CHealth.cs
Normal file
34
scenes/health/CHealth.cs
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
[GlobalClass]
|
||||||
|
public partial class CHealth : Node, IHealthable
|
||||||
|
{
|
||||||
|
[Signal]
|
||||||
|
public delegate void HealthChangedEventHandler(float health);
|
||||||
|
[Signal]
|
||||||
|
public delegate void DeadEventHandler();
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RHealth HealthResource;
|
||||||
|
|
||||||
|
public float CurrentHealth { get; set; }
|
||||||
|
|
||||||
|
public override void _Ready()
|
||||||
|
{
|
||||||
|
CurrentHealth = HealthResource.StartingHealth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ReduceHealth(float amount)
|
||||||
|
{
|
||||||
|
CurrentHealth -= amount;
|
||||||
|
EmitSignalHealthChanged(CurrentHealth);
|
||||||
|
|
||||||
|
if (CurrentHealth <= 0)
|
||||||
|
{
|
||||||
|
CurrentHealth = 0;
|
||||||
|
EmitSignalDead();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scenes/health/CHealth.cs.uid
Normal file
1
scenes/health/CHealth.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bjwrpv3jpsc1e
|
||||||
6
scenes/health/CHealth.tscn
Normal file
6
scenes/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://scenes/health/CHealth.cs" id="1_75uyt"]
|
||||||
|
|
||||||
|
[node name="CHealth" type="Node"]
|
||||||
|
script = ExtResource("1_75uyt")
|
||||||
62
scenes/movement/CFlyingMovement.cs
Normal file
62
scenes/movement/CFlyingMovement.cs
Normal file
@@ -0,0 +1,62 @@
|
|||||||
|
using Godot;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
namespace Movementtests.scenes.movement;
|
||||||
|
|
||||||
|
public partial class CFlyingMovement : Node3D, IMoveable
|
||||||
|
{
|
||||||
|
[Export] public RMovement RMovement;
|
||||||
|
|
||||||
|
[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 new 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 = direction * RMovement.Speed;
|
||||||
|
|
||||||
|
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 = _randomDirection * RMovement.Speed;
|
||||||
|
|
||||||
|
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
scenes/movement/CFlyingMovement.cs.uid
Normal file
1
scenes/movement/CFlyingMovement.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://cps1rbkxs3nvq
|
||||||
7
scenes/movement/CFlyingMovement.tscn
Normal file
7
scenes/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://scenes/movement/CFlyingMovement.cs" id="1_i26q2"]
|
||||||
|
|
||||||
|
[node name="CFlyingMovement" type="Node3D"]
|
||||||
|
script = ExtResource("1_i26q2")
|
||||||
|
CollisionMask = 256
|
||||||
33
scenes/movement/CGroundedMovement.cs
Normal file
33
scenes/movement/CGroundedMovement.cs
Normal file
@@ -0,0 +1,33 @@
|
|||||||
|
using Godot;
|
||||||
|
using Movementtests.interfaces;
|
||||||
|
|
||||||
|
namespace Movementtests.scenes.movement;
|
||||||
|
|
||||||
|
public partial class CGroundedMovement : Node3D, IMoveable
|
||||||
|
{
|
||||||
|
[Export] public RMovement RMovement;
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public RayCast3D WallInFrontRayCast { get; set; }
|
||||||
|
|
||||||
|
|
||||||
|
public new 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);
|
||||||
|
|
||||||
|
velocity.X = direction.X * RMovement.Speed;
|
||||||
|
velocity.Z = direction.Z * RMovement.Speed;
|
||||||
|
|
||||||
|
if (WallInFrontRayCast.IsColliding())
|
||||||
|
velocity.Y = RMovement.Speed;
|
||||||
|
else if (!inputs.isOnFloor)
|
||||||
|
velocity += inputs.gravity * (float)inputs.delta;
|
||||||
|
|
||||||
|
return velocity;
|
||||||
|
}
|
||||||
|
}
|
||||||
1
scenes/movement/CGroundedMovement.cs.uid
Normal file
1
scenes/movement/CGroundedMovement.cs.uid
Normal file
@@ -0,0 +1 @@
|
|||||||
|
uid://bdag2eeixw2lt
|
||||||
6
scenes/movement/CGroundedMovement.tscn
Normal file
6
scenes/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://scenes/movement/CGroundedMovement.cs" id="1_e0agf"]
|
||||||
|
|
||||||
|
[node name="CGroundedMovement" type="Node3D"]
|
||||||
|
script = ExtResource("1_e0agf")
|
||||||
61
scenes/spawners/Spawner.cs
Normal file
61
scenes/spawners/Spawner.cs
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
using Godot;
|
||||||
|
using System;
|
||||||
|
|
||||||
|
public partial class Spawner : Node3D
|
||||||
|
{
|
||||||
|
[Export(PropertyHint.NodeType)]
|
||||||
|
public PackedScene SceneToSpawn { get; set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
|
public Resource Inputs;
|
||||||
|
[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 (SceneToSpawn == null || !SceneToSpawn.CanInstantiate()) return;
|
||||||
|
|
||||||
|
var spawnedInstance = SceneToSpawn.Instantiate() as Enemy;
|
||||||
|
if (spawnedInstance == null) return;
|
||||||
|
|
||||||
|
// spawnedInstance.Inputs = Inputs as EnemyInitInputs;
|
||||||
|
spawnedInstance.Target = Target;
|
||||||
|
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/first_enemy/first_enemy.tscn" id="2_2otbo"]
|
||||||
|
|
||||||
|
[node name="Spawner" type="Node3D"]
|
||||||
|
script = ExtResource("1_2otbo")
|
||||||
|
SceneToSpawn = ExtResource("2_2otbo")
|
||||||
|
|
||||||
|
[node name="Marker3D" type="Marker3D" 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
|
||||||
Reference in New Issue
Block a user