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(
IMyTerminalBlock block,
MyIni ini,
string sectionName = "sequence")
{
if (block is IMyMotorStator)
{
return new SequenceableRotor(block as IMyMotorStator, ini, sectionName);
}
if (block is IMyPistonBase)
{
// return new SequenceablePiston(block as IMyPistonBase, step);
}
if (block is IMyShipMergeBlock)
{
// return new SequenceableMergeBlock(block as IMyShipMergeBlock, step);
}
if (block is IMyDoor)
{
return new SequenceableDoor(block as IMyDoor, ini, sectionName);
}
return null;
}
}
}
}