Various enemy debugging stuff

This commit is contained in:
2025-04-10 02:10:49 -07:00
parent 753ba60f0f
commit 078bfb9e45
15 changed files with 909 additions and 789 deletions

View File

@@ -37,7 +37,7 @@ public partial class BossTypeA : Enemy, IHasPrimaryAttack, IHasSecondaryAttack,
_attackTimer.Start();
}
public new void OnPhysicsProcess(double delta)
public void OnPhysicsProcess(double delta)
{
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));

View File

@@ -31,7 +31,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
[Export] protected EnemyStatResource _enemyStatResource { get; set; } = default!;
[Export]
protected float _movementSpeed = 2f;
protected float _movementSpeed = 0.5f;
#endregion
#region Node Dependencies
@@ -48,11 +48,13 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
public AutoProp<double> CurrentHP { get; set; }
public string EnemyName;
private float _knockbackStrength = 0.0f;
private Vector3 _knockbackDirection = Vector3.Zero;
private IDamageCalculator _damageCalculator;
private DamageCalculator _damageCalculator;
#region Godot methods
public void Setup()
@@ -98,7 +100,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
_enemyModelView.SetCurrentDirection(GlobalBasis, -_player.CurrentBasis.Z);
if (_enemyModelView is EnemyModelView2D enemyModelView2D)
if (_enemyModelView is EnemyModelView2D)
{
if (_enemyLogic.Value is EnemyLogic.State.Patrolling or EnemyLogic.State.FollowPlayer)
_enemyModelView.PlayWalkAnimation();
@@ -119,8 +121,8 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
public virtual void Move(Vector3 velocity)
{
_knockbackStrength = _knockbackStrength * 0.9f;
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
_knockbackStrength *= 0.9f;
Velocity = velocity * _movementSpeed + (_knockbackDirection * _knockbackStrength);
MoveAndSlide();
}
@@ -162,6 +164,7 @@ public partial class Enemy : CharacterBody3D, IEnemy, IProvide<IEnemyLogic>
public virtual void Die()
{
SetProcess(false);
_movementSpeed = 0;
CurrentHP.OnNext(0);
_enemyLogic.Input(new EnemyLogic.Input.EnemyDefeated());
_collisionShape.SetDeferred("disabled", true);

View File

@@ -1,6 +1,8 @@
using Chickensoft.AutoInject;
using Chickensoft.GodotNodeInterfaces;
using Chickensoft.Introspection;
using Godot;
using System.Linq;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))]
@@ -173,14 +175,23 @@ public partial class EnemyModelView2D : Node3D, IEnemyModelView
private void LoadShader(string shaderPath)
{
var shader = GD.Load<Shader>(shaderPath);
AnimatedSprite.Material = new ShaderMaterial();
var shaderMaterial = (ShaderMaterial)AnimatedSprite.Material;
shaderMaterial.Shader = shader;
var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast<AnimatedSprite2D>();
foreach (var sprite in sprites)
{
sprite.Material = new ShaderMaterial();
var shaderMaterial = (ShaderMaterial)sprite.Material;
shaderMaterial.Shader = shader;
}
}
private void SetShaderValue(float shaderValue)
{
var shaderMaterial = (ShaderMaterial)AnimatedSprite.Material;
shaderMaterial.SetShaderParameter("progress", shaderValue);
var sprites = FindChildren("*", "AnimatedSprite2D", true).Cast<AnimatedSprite2D>();
foreach (var sprite in sprites)
{
var shaderMaterial = (ShaderMaterial)sprite.Material;
shaderMaterial.SetShaderParameter("progress", shaderValue);
}
}
}

View File

@@ -1,9 +1,3 @@
[gd_resource type="ShaderMaterial" load_steps=2 format=3 uid="uid://x2bv1q51mcjq"]
[ext_resource type="Shader" path="res://src/vfx/shaders/PixelMelt.gdshader" id="1_fbp5a"]
[gd_resource type="ShaderMaterial" format=3 uid="uid://x2bv1q51mcjq"]
[resource]
shader = ExtResource("1_fbp5a")
shader_parameter/progress = 0.0
shader_parameter/meltiness = 1.0
shader_parameter/reverse = false

View File

@@ -26,7 +26,7 @@ public partial class FilthEater : Enemy, IHasPrimaryAttack, IHasSecondaryAttack,
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
}
public new void OnPhysicsProcess(double delta)
public void OnPhysicsProcess(double delta)
{
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));

View File

@@ -1,12 +1,13 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
using Zennysoft.Game.Abstractions;
using Zennysoft.Ma.Adapter;
namespace Zennysoft.Game.Ma;
[Meta(typeof(IAutoNode))]
public partial class Chariot : Enemy, IHasPrimaryAttack, ICanActivate
public partial class Chariot : Enemy, IHasPrimaryAttack, ICanActivate, ICanPatrol
{
[Export]
public ElementType PrimaryAttackElementalType { get; set; } = ElementType.None;
@@ -15,18 +16,52 @@ public partial class Chariot : Enemy, IHasPrimaryAttack, ICanActivate
[Node] public ChariotModelView EnemyModelView { get; set; } = default;
[Node] private INavigationAgentClient _navigationAgentClient { get; set; } = default!;
private bool _activated = false;
public void OnPhysicsProcess(double delta)
{
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
if (_enemyLogic.Value is EnemyLogic.State.FollowPlayer && GlobalPosition.DistanceTo(_player.CurrentPosition) < 4f)
_enemyLogic.Input(new EnemyLogic.Input.StartAttacking());
if (_enemyLogic.Value is EnemyLogic.State.FollowPlayer && GlobalPosition.DistanceTo(_player.CurrentPosition) > 45f)
if (_enemyLogic.Value is EnemyLogic.State.FollowPlayer && GlobalPosition.DistanceTo(_player.CurrentPosition) > 25f)
_enemyLogic.Input(new EnemyLogic.Input.LostPlayer());
if (_enemyLogic.Value is EnemyLogic.State.Attacking && GlobalPosition.DistanceTo(_player.CurrentPosition) > 5f)
_enemyLogic.Input(new EnemyLogic.Input.Alerted());
if (_activated)
_movementSpeed = 0;
_navigationAgentClient.CalculateVelocity(GlobalPosition, true);
base._PhysicsProcess(delta);
}
public override void _Process(double delta)
{
if (CurrentHP.Value <= 0)
return;
var lookDir = GlobalPosition + Velocity;
if (!lookDir.IsEqualApprox(GlobalPosition))
LookAt(lookDir, Vector3.Up, true);
_enemyModelView.SetCurrentDirection(GlobalBasis, -_player.CurrentBasis.Z);
if (_enemyModelView is EnemyModelView2D && !_activated)
{
if (Velocity > Vector3.Zero)
_enemyModelView.PlayWalkAnimation();
else
_enemyModelView.PlayIdleAnimation();
}
}
public override void Die()
{
_navigationAgentClient.Stop();
base.Die();
}
public override void TakeAction()
@@ -40,6 +75,21 @@ public partial class Chariot : Enemy, IHasPrimaryAttack, ICanActivate
public void Activate()
{
if (_activated)
return;
EnemyModelView.Activate();
_activated = true;
}
public override void SetTarget(Vector3 target) => _navigationAgentClient.SetTarget(target);
public void Patrol()
{
var rng = new RandomNumberGenerator();
rng.Randomize();
var randomizedSpot = new Vector3(rng.RandfRange(-5.0f, 5.0f), 0, rng.RandfRange(-5.0f, 5.0f));
_enemyLogic.Input(new EnemyLogic.Input.PatrolToRandomSpot(GlobalPosition + randomizedSpot));
_enemyLogic.Input(new EnemyLogic.Input.StartPatrol());
}
}

View File

@@ -1,8 +1,9 @@
[gd_scene load_steps=8 format=3 uid="uid://dlw5cvutvypxn"]
[gd_scene load_steps=9 format=3 uid="uid://dlw5cvutvypxn"]
[ext_resource type="Script" uid="uid://djx5x5bhkku85" path="res://src/enemy/enemy_types/06. chariot/Chariot.cs" id="1_hqeyd"]
[ext_resource type="Script" uid="uid://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_77bk6"]
[ext_resource type="PackedScene" uid="uid://dcm53j3rncxdm" path="res://src/enemy/enemy_types/06. chariot/ChariotModelView.tscn" id="3_q1q0f"]
[ext_resource type="PackedScene" uid="uid://pbnsngx5jvrh" path="res://src/enemy/NavigationAgentClient.tscn" id="4_mdd1w"]
[sub_resource type="Resource" id="Resource_dvne1"]
script = ExtResource("2_77bk6")
@@ -35,7 +36,7 @@ radius = 1.20703
[node name="Chariot" type="CharacterBody3D"]
process_mode = 1
collision_layer = 10
collision_mask = 11
collision_mask = 3
axis_lock_linear_y = true
axis_lock_angular_x = true
script = ExtResource("1_hqeyd")
@@ -46,10 +47,10 @@ unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_cwfph")
[node name="NavAgent" type="NavigationAgent3D" parent="."]
[node name="Navigation" type="Node3D" parent="."]
[node name="NavigationAgentClient" parent="Navigation" instance=ExtResource("4_mdd1w")]
unique_name_in_owner = true
avoidance_enabled = true
debug_path_custom_color = Color(1, 0, 0, 1)
[node name="LineOfSight" type="Area3D" parent="."]
unique_name_in_owner = true
@@ -61,16 +62,6 @@ collision_mask = 2
transform = Transform3D(1, 0, 0, 0, -4.37114e-08, 1, 0, -1, -4.37114e-08, 0, 0, -2)
shape = SubResource("CylinderShape3D_jbgmx")
[node name="PatrolTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 10.0
autostart = true
[node name="AttackTimer" type="Timer" parent="."]
unique_name_in_owner = true
wait_time = 0.8
autostart = true
[node name="Collision" type="Area3D" parent="."]
collision_layer = 2048
collision_mask = 0
@@ -84,3 +75,15 @@ transform = Transform3D(0.999848, 0, 0.0174524, 0, 1, 0, -0.0174524, 0, 0.999848
[node name="Raycast" type="RayCast3D" parent="."]
unique_name_in_owner = true
[node name="Timers" type="Node" parent="."]
[node name="PatrolTimer" type="Timer" parent="Timers"]
unique_name_in_owner = true
wait_time = 10.0
autostart = true
[node name="AttackTimer" type="Timer" parent="Timers"]
unique_name_in_owner = true
wait_time = 0.8
autostart = true

File diff suppressed because one or more lines are too long

View File

@@ -33,6 +33,7 @@ axis_lock_angular_z = true
motion_mode = 1
script = ExtResource("1_vw2ww")
_enemyStatResource = ExtResource("2_d665t")
_movementSpeed = 2.0
[node name="NavigationAgentClient" parent="." instance=ExtResource("3_d665t")]
unique_name_in_owner = true

View File

@@ -30,7 +30,7 @@ public partial class ShieldOfHeaven : Enemy, IHasPrimaryAttack, IHasSecondaryAtt
((EnemyModelView2D)_enemyModelView).Hitbox.AreaEntered += Hitbox_AreaEntered;
}
public new void OnPhysicsProcess(double delta)
public void OnPhysicsProcess(double delta)
{
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));

View File

@@ -1,27 +1,10 @@
[gd_scene load_steps=8 format=3 uid="uid://5s7c4dsb1wwk"]
[ext_resource type="Script" uid="uid://cjdivu0v1kfhy" path="res://src/enemy/enemy_types/12. Shield of Heaven/ShieldOfHeaven.cs" id="1_ips1f"]
[ext_resource type="Script" uid="uid://dnkmr0eq1sij0" path="res://src/enemy/EnemyStatResource.cs" id="2_oxa5b"]
[ext_resource type="Resource" uid="uid://c5fgcsruq5gx6" path="res://src/enemy/enemy_types/12. Shield of Heaven/ShieldOfHeavenStats.tres" id="2_oxa5b"]
[ext_resource type="PackedScene" uid="uid://pbnsngx5jvrh" path="res://src/enemy/NavigationAgentClient.tscn" id="3_d5a6t"]
[ext_resource type="PackedScene" uid="uid://drkaq6grim1fb" path="res://src/enemy/enemy_types/12. Shield of Heaven/ShieldModelView.tscn" id="3_r2swr"]
[sub_resource type="Resource" id="Resource_r2swr"]
script = ExtResource("2_oxa5b")
CurrentHP = 100.0
MaximumHP = 100
CurrentAttack = 10
CurrentDefense = 10
MaxAttack = 10
MaxDefense = 10
ExpFromDefeat = 0
Luck = 0.05
_telluricResistance = 0.0
_aeolicResistance = 0.0
_hydricResistance = 0.0
_igneousResistance = 0.0
_ferrumResistance = 0.0
DropsSoulGemChance = 0.75
metadata/_custom_type_script = "uid://dnkmr0eq1sij0"
[sub_resource type="CapsuleShape3D" id="CapsuleShape3D_cwfph"]
radius = 0.226425
height = 2.02807
@@ -40,19 +23,15 @@ collision_mask = 11
axis_lock_linear_y = true
axis_lock_angular_x = true
script = ExtResource("1_ips1f")
_enemyStatResource = SubResource("Resource_r2swr")
_enemyStatResource = ExtResource("2_oxa5b")
[node name="CollisionShape3D" type="CollisionShape3D" parent="."]
[node name="CollisionShape" type="CollisionShape3D" parent="."]
unique_name_in_owner = true
transform = Transform3D(-1, 0, -8.74228e-08, 0, 1, 0, 8.74228e-08, 0, -1, 0, 0, 0)
shape = SubResource("CapsuleShape3D_cwfph")
[node name="NavAgent" type="NavigationAgent3D" parent="."]
[node name="NavigationAgentClient" parent="." instance=ExtResource("3_d5a6t")]
unique_name_in_owner = true
path_max_distance = 3.01
simplify_path = true
avoidance_enabled = true
radius = 2.0
debug_path_custom_color = Color(1, 0, 0, 1)
[node name="LineOfSight" type="Area3D" parent="."]
unique_name_in_owner = true

View File

@@ -13,7 +13,7 @@ public partial class GoldSproingy : Enemy
SetPhysicsProcess(true);
}
public new void OnPhysicsProcess(double delta)
public void OnPhysicsProcess(double delta)
{
_enemyLogic.Input(new EnemyLogic.Input.PhysicsTick(delta));
}

View File

@@ -36,8 +36,8 @@ public partial class EnemyLogic
var enemy = Get<IEnemy>();
if (enemy is IHasRangedAttack rangedAttacker)
rangedAttacker.RangedAttack();
if (enemy is Chinthe chinthe)
chinthe.Activate();
if (enemy is ICanActivate canActivate)
canActivate.Activate();
return To<FollowPlayer>();
}
}

View File

@@ -1,9 +1,28 @@
[gd_scene load_steps=8 format=3 uid="uid://8f3dk16nj0dn"]
[gd_scene load_steps=27 format=3 uid="uid://8f3dk16nj0dn"]
[ext_resource type="Script" uid="uid://l1v4ppubryd3" path="res://src/ui/pause_menu/PauseDebugMenu.cs" id="1_a7f7f"]
[ext_resource type="FontFile" uid="uid://dp1k143v7cppw" path="res://src/ui/fonts/Lust_Sans_Regular.otf" id="1_dan2i"]
[ext_resource type="LabelSettings" uid="uid://wc363u5t1yi2" path="res://src/ui/label_settings/HeadingFont.tres" id="2_a7f7f"]
[ext_resource type="FontFile" uid="uid://dit3vylt7hmmx" path="res://src/ui/fonts/FT88-Regular.ttf" id="3_k06jx"]
[ext_resource type="PackedScene" uid="uid://dbvr8ewajja6a" path="res://src/enemy/EnemyDatabase.tscn" id="5_274g5"]
[ext_resource type="PackedScene" uid="uid://bs56ccgosmu47" path="res://src/enemy/enemy_types/01. sproingy/Sproingy.tscn" id="6_ue0ua"]
[ext_resource type="PackedScene" uid="uid://b0gwivt7cw7nd" path="res://src/enemy/enemy_types/02. michael/Michael.tscn" id="7_gidvx"]
[ext_resource type="PackedScene" uid="uid://cvk007twac22c" path="res://src/enemy/enemy_types/03. filth_eater/FilthEater.tscn" id="8_m457y"]
[ext_resource type="PackedScene" uid="uid://bksq62muhk3h5" path="res://src/enemy/enemy_types/04. sara/Sara.tscn" id="9_i65lo"]
[ext_resource type="PackedScene" uid="uid://feegakykn3fv" path="res://src/enemy/enemy_types/05. ballos/Ballos.tscn" id="10_ct6et"]
[ext_resource type="PackedScene" uid="uid://dlw5cvutvypxn" path="res://src/enemy/enemy_types/06. chariot/Chariot.tscn" id="11_fk1r1"]
[ext_resource type="PackedScene" uid="uid://c6tqt27ql8s35" path="res://src/enemy/enemy_types/07. chinthe/Chinthe.tscn" id="12_yh23m"]
[ext_resource type="PackedScene" uid="uid://b8ewfgcjv60es" path="res://src/enemy/enemy_types/09. Agi/AgiDemon.tscn" id="13_tns3g"]
[ext_resource type="PackedScene" uid="uid://dpq17ej06uah1" path="res://src/enemy/enemy_types/9b. Aqueos Demon/AqueosDemon.tscn" id="14_fmyye"]
[ext_resource type="PackedScene" uid="uid://fosk3kt7vp8d" path="res://src/enemy/enemy_types/08a. Ambassador/Ambassador.tscn" id="15_1f6di"]
[ext_resource type="PackedScene" uid="uid://c5gbaybqm4cuk" path="res://src/enemy/enemy_types/08b. Ambassador (red)/AmbassadorRed.tscn" id="16_r6xvd"]
[ext_resource type="PackedScene" uid="uid://b4oliop60eghn" path="res://src/enemy/enemy_types/08c. Ambassador (steel)/AmbassadorSteel.tscn" id="17_bmukk"]
[ext_resource type="PackedScene" uid="uid://cmvimr0pvsgqy" path="res://src/enemy/enemy_types/10. Eden Pillar/Eden Pillar.tscn" id="18_6mn3f"]
[ext_resource type="PackedScene" uid="uid://boqjebx7yuiqy" path="res://src/enemy/enemy_types/11. Palan/Palan.tscn" id="19_gq2v4"]
[ext_resource type="PackedScene" uid="uid://5s7c4dsb1wwk" path="res://src/enemy/enemy_types/12. Shield of Heaven/ShieldOfHeaven.tscn" id="20_hd5x0"]
[ext_resource type="PackedScene" uid="uid://b3giib0jp3uod" path="res://src/enemy/enemy_types/13. gold sproingy/GoldSproingy.tscn" id="21_q6ugg"]
[ext_resource type="PackedScene" uid="uid://2wibfnu2jvlv" path="res://src/enemy/enemy_types/14. horse_head/HorseFace.tscn" id="22_b68ey"]
[ext_resource type="PackedScene" uid="uid://6dnsw37d1uw4" path="res://src/enemy/enemy_types/15. ox_face/OxFace.tscn" id="23_cbsio"]
[sub_resource type="Theme" id="Theme_0tcdw"]
default_font = ExtResource("3_k06jx")
@@ -14,7 +33,7 @@ bg_color = Color(0.2484, 0.2484, 0.2484, 1)
[sub_resource type="StyleBoxFlat" id="StyleBoxFlat_1ctjd"]
[node name="Control" type="Control"]
[node name="Control" type="Control" node_paths=PackedStringArray("_enemyDatabase")]
layout_mode = 3
anchors_preset = 15
anchor_right = 1.0
@@ -22,6 +41,7 @@ anchor_bottom = 1.0
grow_horizontal = 2
grow_vertical = 2
script = ExtResource("1_a7f7f")
_enemyDatabase = NodePath("EnemyDatabase")
[node name="MarginContainer" type="MarginContainer" parent="."]
process_mode = 3
@@ -80,7 +100,7 @@ label_settings = ExtResource("2_a7f7f")
unique_name_in_owner = true
layout_mode = 2
focus_neighbor_top = NodePath("../LoadNextFloorButton")
focus_neighbor_bottom = NodePath(".")
focus_neighbor_bottom = NodePath("../SpawnEnemyDropDown")
theme_override_styles/normal = SubResource("StyleBoxFlat_1ctjd")
[node name="Label2" type="Label" parent="MarginContainer/VBoxContainer/HBoxContainer/VFlowContainer"]
@@ -91,6 +111,10 @@ label_settings = ExtResource("2_a7f7f")
[node name="SpawnEnemyDropDown" type="OptionButton" parent="MarginContainer/VBoxContainer/HBoxContainer/VFlowContainer"]
unique_name_in_owner = true
layout_mode = 2
focus_neighbor_top = NodePath("../LoadNextFloorButton")
focus_neighbor_top = NodePath("../SpawnItemDropDown")
focus_neighbor_bottom = NodePath(".")
theme_override_styles/normal = SubResource("StyleBoxFlat_1ctjd")
[node name="EnemyDatabase" parent="." instance=ExtResource("5_274g5")]
EnemyList = Array[PackedScene]([ExtResource("6_ue0ua"), ExtResource("7_gidvx"), ExtResource("8_m457y"), ExtResource("9_i65lo"), ExtResource("10_ct6et"), ExtResource("11_fk1r1"), ExtResource("12_yh23m"), ExtResource("13_tns3g"), ExtResource("14_fmyye"), ExtResource("15_1f6di"), ExtResource("16_r6xvd"), ExtResource("17_bmukk"), ExtResource("18_6mn3f"), ExtResource("19_gq2v4"), ExtResource("20_hd5x0"), ExtResource("21_q6ugg"), ExtResource("22_b68ey"), ExtResource("23_cbsio")])
SpawnRate = PackedFloat32Array()

View File

@@ -1,6 +1,7 @@
using Chickensoft.AutoInject;
using Chickensoft.Introspection;
using Godot;
using System;
using System.Collections.Immutable;
using System.Linq;
using Zennysoft.Ma.Adapter;
@@ -23,33 +24,41 @@ public partial class PauseDebugMenu : Control, IDebugMenu
[Node] public OptionButton SpawnEnemyDropDown { get; set; } = default!;
private ImmutableList<InventoryItem> _spawnableItems;
private ImmutableList<PackedScene> _spawnableEnemies;
private ImmutableList<string> _spawnableEnemies;
[Export]
private EnemyDatabase _enemyDatabase;
private ItemDatabase _itemDatabase;
private string _sproingyScene = @"res://src/enemy/enemy_types/01. sproingy/Sproingy.tscn";
private string _michaelScene = @"res://src/enemy/enemy_types/02. michael/Michael.tscn";
private string _filthEaterScene = @"res://src/enemy/enemy_types/03. filth_eater/FilthEater.tscn";
public override void _Ready()
{
VisibilityChanged += PauseDebugMenu_VisibilityChanged;
LoadNextFloorButton.Pressed += LoadNextFloorButton_Pressed;
_itemDatabase = new ItemDatabase();
_spawnableItems = _itemDatabase.Items;
_spawnableEnemies = [];
foreach (var item in _spawnableItems)
SpawnItemDropDown.AddItem(item.ItemName, _spawnableItems.IndexOf(item));
SpawnItemDropDown.AddItem(item.ItemName);
_spawnableEnemies = [.. _enemyDatabase.EnemyList];
foreach (var enemy in _spawnableEnemies)
{
var tempEnemy = enemy.Instantiate<Enemy>();
SpawnEnemyDropDown.AddItem(tempEnemy.Name);
}
SpawnItemDropDown.ItemSelected += SpawnItemDropDown_ItemSelected;
_spawnableEnemies = [_sproingyScene, _michaelScene, _filthEaterScene];
SpawnEnemyDropDown.ItemSelected += SpawnEnemyDropDown_ItemSelected;
}
private void SpawnEnemyDropDown_ItemSelected(long index)
{
var enemyToSpawn = _spawnableEnemies.ElementAt((int)index);
var loadedEnemy = enemyToSpawn.Instantiate<Enemy>();
loadedEnemy.GlobalPosition = new Vector3(_player.CurrentPosition.X, _player.CurrentPosition.Y + 1, _player.CurrentPosition.Z) + (-_player.CurrentBasis.Z * 2);
AddChild(loadedEnemy);
}
private void SpawnItemDropDown_ItemSelected(long index)