2025-09-30 16:23:05 +02:00
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Babushka.scripts.CSharp.Common.Util;
|
2025-09-12 13:20:27 +02:00
|
|
|
using Godot;
|
|
|
|
|
|
|
|
|
|
namespace Babushka.scripts.CSharp.Common.Fight;
|
|
|
|
|
|
2025-09-21 14:54:55 +02:00
|
|
|
public partial class FightRoomSceneSetup : Node
|
2025-09-12 13:20:27 +02:00
|
|
|
{
|
2025-09-30 16:23:05 +02:00
|
|
|
[Export(PropertyHint.ArrayType)] private Node2D[] _enemyGroupSpawns;
|
|
|
|
|
[Export] private PackedScene _roamingEnemyGroupPrefab;
|
|
|
|
|
[Export] private FightSceneSwitcher _fightSceneSwitcher;
|
|
|
|
|
|
|
|
|
|
|
2025-09-12 13:20:27 +02:00
|
|
|
public override void _Ready()
|
|
|
|
|
{
|
|
|
|
|
var room = FightWorld.Instance.currentRoom!;
|
2025-09-30 16:23:05 +02:00
|
|
|
|
|
|
|
|
var i = 0;
|
|
|
|
|
foreach (var availableParent in _enemyGroupSpawns.Shuffle())
|
2025-09-12 13:20:27 +02:00
|
|
|
{
|
2025-09-30 16:23:05 +02:00
|
|
|
var enemyGroup = room.enemyGroups[i];
|
|
|
|
|
var roamingEnemyGroup = _roamingEnemyGroupPrefab.Instantiate<RoamingEnemyGroup>();
|
|
|
|
|
roamingEnemyGroup.Initialize(enemyGroup, _fightSceneSwitcher);
|
|
|
|
|
availableParent.AddChild(roamingEnemyGroup);
|
|
|
|
|
if (i >= room.enemyGroups.Count - 1) break;
|
|
|
|
|
i++;
|
2025-09-12 13:20:27 +02:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|