using System; using System.Collections.Generic; using System.Linq; using Gamesmiths.Forge.Attributes; using Gamesmiths.Forge.Godot.Nodes; using Godot; using Godot.Collections; using Movementtests.forge.attribute_sets; using Movementtests.scenes.enemies; using Movementtests.scenes.player_controller.components.weapon; using Movementtests.scenes.player_controller.scripts; namespace Movementtests.tools; public static class ForgeUtils { public enum AttributeSetType { Meta, Player, Enemy, Weapon, Character } public static System.Collections.Generic.Dictionary> AttributeSetMap { get; } = new() { { AttributeSetType.Meta, () => new MetaAttributeSet() }, { AttributeSetType.Player, () => new PlayerAttributeSet() }, { AttributeSetType.Enemy, () => new EnemyAttributeSet() }, { AttributeSetType.Weapon, () => new WeaponAttributeSet() }, { AttributeSetType.Character, () => new CharacterAttributeSet() }, }; public static List CollectAttributeList(Node node) { List attributeSetList = []; foreach (var child in node.GetChildren()) { if (child is not ForgeAttributeSet attributeSetNode) continue; var attributeSet = attributeSetNode.GetAttributeSet(); if (attributeSet is not null) attributeSetList.Add(attributeSet); } return attributeSetList; } public static List CollectAttributeList(Array types) { return types.Select(type => AttributeSetMap[type]()).ToList(); } }