space_engineers/Mixins/Sequencer/SequenceableFactory.cs

38 lines
1.2 KiB
C#

// I hate Factories, but when the shoe fits...
using Sandbox.ModAPI.Ingame;
using SpaceEngineers.Game.ModAPI.Ingame;
using VRage.Game.ModAPI.Ingame.Utilities;
namespace IngameScript
{
partial class Program
{
public class SequenceableFactory
{
public static ISequenceable MakeSequenceable(
Program program,
IMyTerminalBlock block,
string sectionName = "sequence")
{
if (block is IMyMotorStator)
{
return new SequenceableRotor(program, block as IMyMotorStator, sectionName);
}
if (block is IMyPistonBase)
{
return new SequenceablePiston(program, block as IMyPistonBase, sectionName);
}
if (block is IMyShipMergeBlock)
{
// return new SequenceableMergeBlock(block as IMyShipMergeBlock, step);
}
if (block is IMyDoor)
{
return new SequenceableDoor(program, block as IMyDoor, sectionName);
}
return null;
}
}
}
}