本文整理汇总了C#中IMyCubeGrid类的典型用法代码示例。如果您正苦于以下问题:C# IMyCubeGrid类的具体用法?C# IMyCubeGrid怎么用?C# IMyCubeGrid使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
IMyCubeGrid类属于命名空间,在下文中一共展示了IMyCubeGrid类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Depressurize
public static int Depressurize(IMyCubeGrid grid, int strength, TimeSpan duration, long effectOwner)
{
AirVentDepressurize av;
if (!Registrar.TryGetValue(grid, out av))
av = new AirVentDepressurize(grid);
return av.AddEffect(duration, strength, effectOwner);
}
示例2: DisableTurrets
public static int DisableTurrets(IMyCubeGrid grid, int strength, TimeSpan duration)
{
DisableTurret dt;
if (!Registrar.TryGetValue(grid, out dt))
dt = new DisableTurret(grid);
return dt.AddEffect(duration, strength);
}
示例3: PlanetChecker
public PlanetChecker(IMyCubeGrid grid)
{
this.m_logger = new Logger(GetType().Name, grid.getBestName, ClosestPlanet.getBestName, CurrentState.ToString);
this.m_grid = grid;
this.m_cells = new MyQueue<Vector3I>(8);
this.m_cellsUnique = new HashSet<Vector3I>();
}
示例4: GyroProfiler
public GyroProfiler(IMyCubeGrid grid)
{
this.m_logger = new Logger("GyroProfiler", () => grid.DisplayName);
this.myGrid = grid;
ClearOverrides();
}
示例5: set_enemy
private bool set_enemy(IMyCubeGrid value)
{
if (value == value_enemy)
return true;
if (value_enemy != null)
if (GridsClaimed.Remove(value_enemy.EntityId))
m_logger.debugLog("Removed " + value_enemy.getBestName() + " from GridsClaimed", "Move()", Logger.severity.TRACE);
else
m_logger.alwaysLog("Failed to remove " + value_enemy.getBestName() + " from GridsClaimed", "Move()", Logger.severity.WARNING);
if (value != null)
{
if (GridsClaimed.ContainsKey(value.EntityId))
{
m_logger.debugLog("Already claimed: " + value.getBestName(), "set_m_enemy()", Logger.severity.INFO);
return false;
}
else
GridsClaimed.Add(value.EntityId, m_controlBlock.CubeGrid);
m_enemyCells = GridCellCache.GetCellCache(value as IMyCubeGrid);
}
m_stage = Stage.None;
value_enemy = value;
return true;
}
示例6: createFromLocal
/// <summary>
/// creates from a local position
/// </summary>
public static RelativeVector3F createFromLocal(Vector3 grid, IMyCubeGrid cubeGrid)
{
RelativeVector3F result = new RelativeVector3F();
result.value__grid = grid;
result.cubeGrid = cubeGrid;
return result;
}
示例7: ReverseGravity
public static int ReverseGravity(IMyCubeGrid grid, int strength, TimeSpan duration, long effectOwner)
{
GravityReverse gg;
if (!Registrar.TryGetValue(grid, out gg))
gg = new GravityReverse(grid);
return gg.AddEffect(duration, strength, effectOwner);
}
示例8: CanTarget
public bool CanTarget(IMyCubeGrid grid)
{
CubeGridCache cache = CubeGridCache.GetFor(grid);
if (m_destroySet && cache.TotalByDefinition() > 0)
return true;
TargetType gridType = grid.GridSizeEnum == MyCubeSize.Small ? TargetType.SmallGrid
: grid.IsStatic ? TargetType.Station
: TargetType.LargeGrid;
List<string> targetBlocks;
if (m_cumulative_targeting.TryGetValue(gridType, out targetBlocks))
{
foreach (string blockType in targetBlocks)
{
//m_logger.debugLog("checking " + grid.DisplayName + " for " + blockType + " blocks", "CanTarget()");
if (cache.CountByDefLooseContains(blockType, func => func.IsWorking, 1) != 0)
return true;
}
}
//else
// m_logger.debugLog("no targeting at all for grid type of: " + grid.DisplayName, "CanTarget()");
return false;
}
示例9: createFromWorld
/// <summary>
/// create from a relative world vector (current position - G.P.S.)
/// </summary>
public static RelativeVector3F createFromWorld(Vector3 world, IMyCubeGrid cubeGrid)
{
RelativeVector3F result = new RelativeVector3F();
result.value__world = world;
result.cubeGrid = cubeGrid;
return result;
}
示例10: gridIdentifier
/// <summary>
/// Gets the hash value for the grid to identify it
/// (because apparently DisplayName doesn't work)
/// </summary>
/// <param name="grid"></param>
/// <returns></returns>
public static String gridIdentifier(IMyCubeGrid grid)
{
String id = grid.ToString();
int start = id.IndexOf('{');
int end = id.IndexOf('}');
return id.Substring(start + 1, end - start);
}
示例11: LockDoors
public static int LockDoors(IMyCubeGrid grid, int strength, TimeSpan duration, long effectOwner)
{
DoorLock dl;
if (!Registrar.TryGetValue(grid, out dl))
dl = new DoorLock(grid);
return dl.AddEffect(duration, strength, effectOwner);
}
示例12: GetAllConnectedBlocks
/// <summary>
/// Gets all the blocks from all valid connected grids. So a grid connected to another grid that also has a few pistons with blocks on it will return
/// all the blocks for the connected grids as well as all the blocks for any connected pistons. (ug)
/// </summary>
/// <param name="gridsProcessed"></param>
/// <param name="grid"></param>
/// <param name="allBlocks"></param>
/// <param name="collect"></param>
public static void GetAllConnectedBlocks(HashSet<IMyEntity> gridsProcessed, IMyCubeGrid grid, List<IMySlimBlock> allBlocks, Func<IMySlimBlock, bool> collect = null)
{
List<IMySlimBlock> currentBlocks = new List<IMySlimBlock>();
List<IMyCubeGrid> connectedGrids = new List<IMyCubeGrid>();
connectedGrids.Add(grid);
while(connectedGrids.Count > 0)
{
IMyCubeGrid currentGrid = connectedGrids.First();
connectedGrids.Remove(currentGrid);
if (gridsProcessed.Contains(currentGrid))
continue;
gridsProcessed.Add(currentGrid);
GetGridBlocks(currentGrid, currentBlocks);
foreach (IMyCubeGrid connectedGrid in GetConnectedGridList(gridsProcessed, currentBlocks))
{
connectedGrids.Add(connectedGrid);
}
if (collect != null)
{
foreach (IMySlimBlock slimBlock in currentBlocks.FindAll(s => collect(s)))
allBlocks.Add(slimBlock);
}
else
{
foreach (IMySlimBlock slimBlock in currentBlocks)
allBlocks.Add(slimBlock);
}
}
}
示例13: TurnTurrets
public static int TurnTurrets(IMyCubeGrid grid, int strength, TimeSpan duration, long effectOwner)
{
TraitorTurret tt;
if (!Registrar.TryGetValue(grid, out tt))
tt = new TraitorTurret(grid);
return tt.AddEffect(duration, strength, effectOwner);
}
示例14: AttachedGrid
private AttachedGrid(IMyCubeGrid grid)
{
this.myLogger = new Logger("AttachedGrid", () => grid.DisplayName);
this.myGrid = grid;
Registrar.Add(grid, this);
myLogger.debugLog("Initialized");
}
示例15: Logger
public Logger(string calling_class, IMyCubeGrid grid, Func<string> default_primary = null, Func<string> default_secondary = null)
{
this.m_classname = calling_class;
this.f_context = () => grid.DisplayName + " - " + grid.EntityId;
this.f_state_primary = default_primary;
this.f_state_secondary = default_secondary;
}