I'm trying to get block using GetBlocksOfType<T>
How to use GetBlocksOfType with condition?
Code:
T GetBlockOfTypeNamed<T>(string Name) where T : IMyTerminalBlock
{
List<IMyTerminalBlock> blocks = new List<IMyTerminalBlock>();
BlockNameCondition_Name = Name;
GridTerminalSystem.GetBlocksOfType<T>(blocks, BlockNameCondition);
if (blocks.Count > 0)
{
return (T)blocks[0];
}
else
{
return default(T);
}
}
string BlockNameCondition_Name; // Keeeeeen!!!
bool BlockNameCondition(IMyTerminalBlock block) { return...