using System; using CryptonymThunder.Code.Resources; using GameCore.Logic; using GameCore.Logic.Interfaces; namespace CryptonymThunder.Code.Factories; public class TriggerActionFactory { public ITriggerAction Create(TriggerActionResource resource) { return resource switch { UnlockDoorActionResource unlock => new UnlockDoorAction(unlock.TargetWorldId), SpawnEntityActionResource spawn => new SpawnEntityAction(spawn.ArchetypeId, spawn.SpawnerWorldId), DebugMessageActionResource debug => new DebugMessageAction(debug.Message), _ => throw new ArgumentOutOfRangeException(nameof(resource), $"TriggerAction type {resource.GetType().Name} not recognized") }; } }