You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
29 lines
944 B
29 lines
944 B
using System.Collections.Generic;
|
|
using Babushka.scripts.CSharp.Common.Util;
|
|
using Godot;
|
|
|
|
namespace Babushka.scripts.CSharp.Common.Fight;
|
|
|
|
public partial class FightRoomSceneSetup : Node
|
|
{
|
|
[Export(PropertyHint.ArrayType)] private Node2D[] _enemyGroupSpawns;
|
|
[Export] private PackedScene _roamingEnemyGroupPrefab;
|
|
[Export] private FightSceneSwitcher _fightSceneSwitcher;
|
|
|
|
|
|
public override void _Ready()
|
|
{
|
|
var room = FightWorld.Instance.currentRoom!;
|
|
|
|
var i = 0;
|
|
foreach (var availableParent in _enemyGroupSpawns.Shuffle())
|
|
{
|
|
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++;
|
|
}
|
|
}
|
|
} |