added enemy inputs as a resource
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 9m48s

This commit is contained in:
2026-01-16 11:18:57 +01:00
parent 9e75193731
commit fd3eb35782
4 changed files with 44 additions and 6 deletions

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=7 format=3 uid="uid://q7uc1h2jpbd2"] [gd_scene load_steps=11 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="PackedScene" uid="uid://dxt0e2ugmttqq" path="res://scenes/enemies/first_enemy.tscn" id="3_3uydm"]
[ext_resource type="Script" uid="uid://b2vdwkiqauhk3" path="res://scenes/enemies/EnemyInitInputs.cs" id="4_nd7vd"]
[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)
@@ -26,6 +27,21 @@ 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")]
@@ -95,11 +111,14 @@ 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")

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 = 5.0f;
public EnemyInitInputs()
{
Speed = 5.0f;
}
public EnemyInitInputs(float speed)
{
Speed = speed;
}
}

View File

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

View File

@@ -7,8 +7,8 @@ public partial class FirstEnemy : CharacterBody3D
[Export] [Export]
public Node3D Target { get; set; } public Node3D Target { get; set; }
[Export(PropertyHint.Range, "0,10,0.1,or_greater")] [Export]
public float Speed = 5.0f; public EnemyInitInputs Inputs;
private RayCast3D _wallInFrontRayCast; private RayCast3D _wallInFrontRayCast;
@@ -26,11 +26,11 @@ public partial class FirstEnemy : CharacterBody3D
LookAt(targetPlane); LookAt(targetPlane);
var velocity = Velocity; var velocity = Velocity;
velocity.X = direction.X * Speed; velocity.X = direction.X * Inputs.Speed;
velocity.Z = direction.Z * Speed; velocity.Z = direction.Z * Inputs.Speed;
if (_wallInFrontRayCast.IsColliding()) if (_wallInFrontRayCast.IsColliding())
velocity.Y = Speed; velocity.Y = Inputs.Speed;
else if (!IsOnFloor()) else if (!IsOnFloor())
velocity += GetGravity() * (float)delta; velocity += GetGravity() * (float)delta;