• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

C# IMyCubeGrid类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中IMyCubeGrid的典型用法代码示例。如果您正苦于以下问题:C# IMyCubeGrid类的具体用法?C# IMyCubeGrid怎么用?C# IMyCubeGrid使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



IMyCubeGrid类属于命名空间,在下文中一共展示了IMyCubeGrid类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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);
 }
开发者ID:his1220,项目名称:Autopilot,代码行数:7,代码来源:AirVentDepressurize.cs


示例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);
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:DisableTurret.cs


示例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>();
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:PlanetChecker.cs


示例4: GyroProfiler

        public GyroProfiler(IMyCubeGrid grid)
        {
            this.m_logger = new Logger("GyroProfiler", () => grid.DisplayName);
            this.myGrid = grid;

            ClearOverrides();
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:GyroProfiler.cs


示例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;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:28,代码来源:Grinder.cs


示例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;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:10,代码来源:RelativeVector3F.cs


示例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);
 }
开发者ID:his1220,项目名称:Autopilot,代码行数:7,代码来源:GravityReverse.cs


示例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;
		}
开发者ID:Sutima,项目名称:Autopilot,代码行数:25,代码来源:Fighter.cs


示例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;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:10,代码来源:RelativeVector3F.cs


示例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);
 }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:13,代码来源:Utility.cs


示例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);
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:DoorLock.cs


示例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);
                }
            }
        }
开发者ID:PhoenixTheSage,项目名称:EssentialsMod,代码行数:41,代码来源:Grid.cs


示例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);
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:TraitorTurret.cs


示例14: AttachedGrid

        private AttachedGrid(IMyCubeGrid grid)
        {
            this.myLogger = new Logger("AttachedGrid", () => grid.DisplayName);
            this.myGrid = grid;
            Registrar.Add(grid, this);

            myLogger.debugLog("Initialized");
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:8,代码来源:AttachedGrid.cs


示例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;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:8,代码来源:Logger.cs


示例16: GridInventoriesManager

 public GridInventoriesManager(IMyCubeGrid grid, List<MyDefinitionId> watchedItems = null)
 {
     Grid = grid;
     Log = new Logger("SEGarden.World.Inventory.GridInventoriesManager", (() => Grid.EntityId.ToString()));
     Totals = new ItemCountsAggregate();
     InventoryTotals = new Dictionary<MyInventoryBase, ItemCountsAggregate>();
     //InventoryAggregate = new Sandbox.Game.Entities.Inventory.MyInventoryAggregate();
     WatchedItems = watchedItems;
 }
开发者ID:zrisher,项目名称:SEGarden,代码行数:9,代码来源:GridInventoriesManager.cs


示例17: getGridType

 /// <summary>
 /// 
 /// </summary>
 /// <param name="grid"></param>
 /// <returns>Type of the grid</returns>
 public static GRIDTYPE getGridType(IMyCubeGrid grid)
 {
     if (grid.IsStatic) {
         return GRIDTYPE.STATION;
     } else {
         if (grid.GridSizeEnum == MyCubeSize.Large)
             return GRIDTYPE.LARGESHIP;
         else
             return GRIDTYPE.SMALLSHIP;
     }
 }
开发者ID:MrZSFG,项目名称:GardenConquest,代码行数:16,代码来源:Utility.cs


示例18: ThrustProfiler

        public ThrustProfiler(IMyCubeGrid grid)
        {
            if (grid == null)
                throw new NullReferenceException("grid");

            myLogger = new Logger("ThrustProfiler", () => grid.DisplayName);
            myLogger = new Logger(grid.DisplayName, "ThrustProfiler");
            myGrid = grid;

            init();
        }
开发者ID:his1220,项目名称:Autopilot,代码行数:11,代码来源:ThrustProfiler.cs


示例19: DerelictTimer

        public DerelictTimer(IMyCubeGrid grid)
        {
            m_Grid = grid;

            m_TimerInfo = null;
            m_Timer = null;

            CompletedPhase = DT_INFO.PHASE.NONE;

            m_Logger = new Logger(m_Grid.EntityId.ToString(), "DerelictTimer");
        }
开发者ID:Devlah,项目名称:GardenConquest,代码行数:11,代码来源:DerelictTimer.cs


示例20: GetCellCache

 public static GridCellCache GetCellCache(IMyCubeGrid grid)
 {
     GridCellCache cache;
     using (lock_cellCache.AcquireExclusiveUsing())
         if (!CellCache.TryGetValue(grid, out cache))
         {
             cache = new GridCellCache(grid);
             CellCache.Add(grid, cache);
         }
     return cache;
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:11,代码来源:GridShapeProfiler.cs



注:本文中的IMyCubeGrid类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# IMyEntity类代码示例发布时间:2022-05-24
下一篇:
C# IMyCubeBlock类代码示例发布时间:2022-05-24
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap