Add TriggerActionFactory and related resources for button and logic sequence components

This commit is contained in:
2025-10-30 02:21:27 +01:00
parent f2ff758dcb
commit 2c126cd7ea
22 changed files with 250 additions and 13 deletions

View File

@@ -0,0 +1,21 @@
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")
};
}
}