moving files around
All checks were successful
Create tag and build when new code gets to main / BumpTag (push) Successful in 18s
Create tag and build when new code gets to main / Export (push) Successful in 10m3s

This commit is contained in:
2026-01-17 17:58:23 +01:00
parent 0dcf4a3f99
commit f7705a6d57
16 changed files with 12 additions and 34 deletions

View File

@@ -0,0 +1,18 @@
using Godot;
using System;
[GlobalClass]
public partial class EnemyInitInputs : Resource
{
[Export(PropertyHint.Range, "0,10,0.1,or_greater")]
public float Speed;
public EnemyInitInputs()
{
Speed = 5.0f;
}
public EnemyInitInputs(float speed)
{
Speed = speed;
}
}

View File

@@ -0,0 +1 @@
uid://b2vdwkiqauhk3

View File

@@ -0,0 +1,90 @@
using Godot;
using System;
using System.Linq;
using Movementtests.interfaces;
[GlobalClass]
public partial class FirstEnemy : CharacterBody3D, IDamageable, IDamageMaker, IHealthable, IKillable
{
[Export]
public Node3D Target { get; set; }
[Export]
public EnemyInitInputs Inputs;
[Export]
public RDamage GetDamageDealt { get; set; }
[Export]
public CHealth CHealth { get; set; }
[Export]
public CDamageable CDamage { get; set; }
[Export]
public RDeathEffect[] DeathEffects { get; set; }
private RayCast3D _wallInFrontRayCast;
private Area3D _damageBox;
public override void _Ready()
{
_wallInFrontRayCast = GetNode<RayCast3D>("WallInFrontRayCast");
_damageBox = GetNode<Area3D>("DamageBox");
_damageBox.BodyEntered += OnDamageBoxTriggered;
CDamage.DamageTaken += ReduceHealth;
CHealth.Dead += Kill;
}
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();
}
public void OnDamageBoxTriggered(Node3D body)
{
if(body is IDamageable damageable) damageable.TakeDamage(GetDamageDealt);
}
public float TakeDamage(RDamage damage)
{
return CDamage.TakeDamage(damage);
}
public float CurrentHealth
{
get => CHealth.CurrentHealth;
set => CHealth.CurrentHealth = value;
}
public void ReduceHealth(float amount)
{
CHealth.ReduceHealth(amount);
}
public void Kill()
{
foreach (var killable in DeathEffects.ToIKillables())
{
killable.Kill();
}
QueueFree();
}
}

View File

@@ -0,0 +1 @@
uid://bn7sc6id7n166

View File

@@ -0,0 +1,105 @@
[gd_scene load_steps=19 format=3 uid="uid://dxt0e2ugmttqq"]
[ext_resource type="Script" uid="uid://bn7sc6id7n166" path="res://scenes/enemies/first_enemy/FirstEnemy.cs" id="1_4yfjf"]
[ext_resource type="Script" uid="uid://b2vdwkiqauhk3" path="res://scenes/enemies/first_enemy/EnemyInitInputs.cs" id="2_42xu3"]
[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://jitubgv6judn" path="res://resource_definitions/RDamage.cs" id="3_1tw73"]
[ext_resource type="Script" uid="uid://b4cwruitopcee" path="res://resource_definitions/RDeathEffect.cs" id="3_onjoj"]
[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"]
[sub_resource type="Resource" id="Resource_66m7n"]
script = ExtResource("2_42xu3")
Speed = 2.0
metadata/_custom_type_script = "uid://b2vdwkiqauhk3"
[sub_resource type="Resource" id="Resource_a6xb8"]
script = ExtResource("3_1tw73")
metadata/_custom_type_script = "uid://jitubgv6judn"
[sub_resource type="Resource" id="Resource_7gyf3"]
script = ExtResource("3_onjoj")
metadata/_custom_type_script = "uid://b4cwruitopcee"
[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="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")]
collision_layer = 16
collision_mask = 273
script = ExtResource("1_4yfjf")
Inputs = SubResource("Resource_66m7n")
GetDamageDealt = SubResource("Resource_a6xb8")
CHealth = NodePath("CHealth")
CDamage = NodePath("CDamageable")
DeathEffects = Array[Object]([SubResource("Resource_7gyf3")])
[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="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")

View 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"

View 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"