23 lines
931 B
C#
23 lines
931 B
C#
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),
|
|
OpenDoorActionResource open => new OpenDoorAction(open.TargetWorldId),
|
|
CloseDoorActionResource close => new CloseDoorAction(close.TargetWorldId),
|
|
_ => throw new ArgumentOutOfRangeException(nameof(resource),
|
|
$"TriggerAction type {resource.GetType().Name} not recognized")
|
|
};
|
|
}
|
|
} |