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

C# IMyCubeBlock类代码示例

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

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



IMyCubeBlock类属于命名空间,在下文中一共展示了IMyCubeBlock类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: ToBlock

        public Vector3 ToBlock(IMyCubeBlock block)
        {
            if (direction_block.HasValue && CubeBlock == block)
            {
                return direction_block.Value;
            }

            Vector3 result = Vector3.PositiveInfinity;
            if (block.CubeGrid == CubeGrid && direction_local.HasValue)
            {
                MatrixD Transform = Matrix.Invert(block.LocalMatrix).GetOrientation();
                result = Vector3.Transform(direction_local.Value, Transform);
            }
            else
            {
                MatrixD Transform = block.WorldMatrixNormalizedInv.GetOrientation();
                result = Vector3.Transform(ToWorld(), Transform);
            }

            if (CubeBlock == null)
            {
                CubeBlock = block;
                direction_block = result;
            }
            return result;
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:26,代码来源:RelativeDirection3F.cs


示例2: ShipController

		public ShipController(IMyCubeBlock block)
			: base(block)
		{
			myLogger = new Logger("ShipController", () => CubeBlock.CubeGrid.DisplayName);
			myController = CubeBlock as Ingame.IMyShipController;
			Registrar.Add(CubeBlock, this);
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:ShipController.cs


示例3: LastSeenTarget

 public LastSeenTarget(LastSeen seen, IMyCubeBlock block = null)
 {
     m_lastSeen = seen;
     m_block = block;
     m_lastPostion = m_lastSeen.LastKnownPosition;
     m_lastPositionUpdate = m_lastSeen.LastSeenAt;
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:Target.cs


示例4: MotorTurret

 public MotorTurret(IMyCubeBlock block, StatorChangeHandler handler)
 {
     this.FaceBlock = block;
     this.myLogger = new Logger("MotorTurret", block);
     this.OnStatorChange = handler;
     this.SetupStators();
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:MotorTurret.cs


示例5: LaserAntenna

		public LaserAntenna(IMyCubeBlock block)
			: base(block)
		{
			myLaserAntenna = CubeBlock as Ingame.IMyLaserAntenna;
			myLogger = new Logger("LaserAntenna", () => CubeBlock.CubeGrid.DisplayName);
			Registrar.Add(block, this);
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:LaserAntenna.cs


示例6: ShipAutopilot

        /// <summary>
        /// Creates an Autopilot for the given ship controller.
        /// </summary>
        /// <param name="block">The ship controller to use</param>
        public ShipAutopilot(IMyCubeBlock block)
        {
            this.m_block = new ShipControllerBlock(block);
            this.m_logger = new Logger(GetType().Name, block);
            this.m_interpreter = new Interpreter(m_block);

            this.m_block.CubeBlock.OnClosing += CubeBlock_OnClosing;

            ((MyCubeBlock)block).ResourceSink.SetRequiredInputFuncByType(new MyDefinitionId(typeof(MyObjectBuilder_GasProperties), "Electricity"), PowerRequired);

            if (Saver.Instance.LoadOldVersion(69))
            {
                int start = block.DisplayNameText.IndexOf('[') + 1, end = block.DisplayNameText.IndexOf(']');
                if (start > 0 && end > start)
                {
                    m_block.AutopilotTerminal.AutopilotCommands = new StringBuilder(block.DisplayNameText.Substring(start, end - start).Trim());
                    int lengthBefore = start - 1;
                    string nameBefore = lengthBefore > 0 ? m_block.Terminal.DisplayNameText.Substring(0, lengthBefore) : string.Empty;
                    end++;
                    int lengthAfter  = m_block.Terminal.DisplayNameText.Length - end;
                    string nameAfter = lengthAfter > 0 ? m_block.Terminal.DisplayNameText.Substring(end, lengthAfter) : string.Empty;
                    m_block.Terminal.SetCustomName((nameBefore + nameAfter).Trim());
                }
            }

            m_logger.debugLog("Created autopilot for: " + block.DisplayNameText);

            Registrar.Add(block, this);
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:33,代码来源:ShipAutopilot.cs


示例7: IsHacker

 public static bool IsHacker(IMyCubeBlock block)
 {
     if (!(block is IMyLandingGear))
         return false;
     string descr = block.GetCubeBlockDefinition().DescriptionString;
     return descr != null && descr.ToLower().Contains("hacker");
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:Hacker.cs


示例8: ManualMessage

        public ManualMessage(IMyCubeBlock block)
        {
            m_logger = new Logger(GetType().Name, block);
            m_block = block;

            Registrar.Add(block, this);
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:ManualMessage.cs


示例9: Logger

        /// <summary>
        /// Creates a Logger that gets the context and states from block and supplied function.
        /// </summary>
        /// <param name="calling_class">the name of the class this Logger belongs to</param>
        /// <param name="block">The block to get context and states from</param>
        /// <param name="default_secondary">the secondary state used when one is not supplied to alwaysLog() or debugLog()</param>
        public Logger(string calling_class, IMyCubeBlock block, Func<string> default_secondary = null)
        {
            this.m_classname = calling_class;

            if (block == null)
            {
                f_context = () => "Null block";
                return;
            }

            this.f_context = () => {
                IMyCubeGrid grid = block.CubeGrid;
                if (grid == null)
                    return "Null grid";
                return grid.DisplayName + " - " + grid.EntityId;
            };

            if (default_secondary == null)
            {
                this.f_state_primary = () => block.DefinitionDisplayNameText;
                this.f_state_secondary = () => block.getNameOnly() + " - " + block.EntityId;
            }
            else
            {
                this.f_state_primary = () => block.getNameOnly() + " - " + block.EntityId;
                this.f_state_secondary = default_secondary;
            }
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:34,代码来源:Logger.cs


示例10: Stator

			public Stator(IMyCubeBlock block)
				: base(block, AttachedGrid.AttachmentKind.Motor)
			{
				this.myLogger = new Logger("Stator", block);
				this.myStator = block as IMyMotorStator;
				Registrar.Add(this.myStator, this);
			}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:StatorRotor.cs


示例11: GuidedMissile

        /// <summary>
        /// Creates a missile with homing and target finding capabilities.
        /// </summary>
        public GuidedMissile(IMyEntity missile, IMyCubeBlock firedBy, TargetingOptions opt, Ammo ammo, LastSeen initialTarget = null, bool isSlave = false)
            : base(missile, firedBy)
        {
            myLogger = new Logger("GuidedMissile", () => missile.getBestName(), () => m_stage.ToString());
            myAmmo = ammo;
            myDescr = ammo.Description;
            if (ammo.Description.HasAntenna)
                myAntenna = new MissileAntenna(missile);
            TryHard = true;

            AllGuidedMissiles.Add(this);
            missile.OnClose += missile_OnClose;

            if (myAmmo.IsCluster && !isSlave)
                myCluster = new Cluster(myAmmo.MagazineDefinition.Capacity - 1);
            accelerationPerUpdate = (myDescr.Acceleration + myAmmo.MissileDefinition.MissileAcceleration) / 60f;
            addSpeedPerUpdate = myDescr.Acceleration / 60f;

            Options = opt;
            Options.TargetingRange = ammo.Description.TargetRange;
            myTargetSeen = initialTarget;

            myLogger.debugLog("Options: " + Options, "GuidedMissile()");
            //myLogger.debugLog("AmmoDescription: \n" + MyAPIGateway.Utilities.SerializeToXML<Ammo.AmmoDescription>(myDescr), "GuidedMissile()");
        }
开发者ID:deimosx6,项目名称:Autopilot,代码行数:28,代码来源:GuidedMissile.cs


示例12: ProgrammableBlock

		public ProgrammableBlock(IMyCubeBlock block)
			: base(block)
		{
			myLogger = new Logger("Programmable block", () => CubeBlock.CubeGrid.DisplayName);
			myProgBlock = CubeBlock as Ingame.IMyProgrammableBlock;
			Registrar.Add(CubeBlock, this);
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:ProgrammableBlock.cs


示例13: BlockInstructions

		protected BlockInstructions(IMyTerminalBlock block)
		{
			m_logger = new Logger("BlockInstructions", block as IMyCubeBlock);
			m_block = block as IMyCubeBlock;

			block.CustomNameChanged += BlockChange;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:BlockInstructions.cs


示例14: FromBlock

 public static RelativeDirection3F FromBlock(IMyCubeBlock block, Vector3 blockDirection)
 {
     RelativeDirection3F result = new RelativeDirection3F(block.CubeGrid);
     result.direction_block = blockDirection;
     result.CubeBlock = block;
     return result;
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:RelativeDirection3F.cs


示例15: Solar

		/// <param name="block">Must be an IMyTerminalBlock</param>
		public Solar(IMyCubeBlock block)
		{
			myBlock = block;
			myLogger = new Logger("Solar", block);
			(myBlock as IMyTerminalBlock).CustomNameChanged += Solar_CustomNameChanged;
			myBlock.OnClose += myBlock_OnClose;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:8,代码来源:Solar.cs


示例16: RadioAntenna

		public RadioAntenna(IMyCubeBlock block)
			: base(block)
		{
			myLogger = new Logger("RadioAntenna", () => CubeBlock.CubeGrid.DisplayName);
			myRadioAntenna = CubeBlock as Ingame.IMyRadioAntenna;
			Registrar.Add(myRadioAntenna, this);
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:RadioAntenna.cs


示例17: ToWorld

 public DirectionWorld ToWorld(IMyCubeBlock block)
 {
     Vector3 result;
     Matrix orientation = block.WorldMatrix.GetOrientation();
     Vector3.Transform(ref vector, ref orientation, out result);
     return new DirectionWorld() { vector = result };
 }
开发者ID:Souper07,项目名称:Autopilot,代码行数:7,代码来源:Direction.cs


示例18: Turret

		public Turret(IMyCubeBlock block)
			: base(block)
		{
			myLogger = new Logger("Turret", () => block.CubeGrid.DisplayName, () => block.DefinitionDisplayNameText, () => block.getNameOnly());
			Registrar.Add(CubeBlock, this);
			//myLogger.debugLog("definition limits = " + definition.MinElevationDegrees + ", " + definition.MaxElevationDegrees + ", " + definition.MinAzimuthDegrees + ", " + definition.MaxAzimuthDegrees, "Turret()");
			//myLogger.debugLog("radian limits = " + minElevation + ", " + maxElevation + ", " + minAzimuth + ", " + maxAzimuth, "Turret()");
		}
开发者ID:his1220,项目名称:Autopilot,代码行数:8,代码来源:Turret.cs


示例19: EndEffect

 protected override int EndEffect(IMyCubeBlock block, int strength)
 {
     m_logger.debugLog("No longer depressurizing: " + block.DisplayNameText + ", remaining strength: " + (strength - 1), "EndEffect()");
     Ingame.IMyAirVent airVent = block as Ingame.IMyAirVent;
     if (airVent.IsDepressurizing)
         airVent.ApplyAction("Depressurize");
     return 1;
 }
开发者ID:his1220,项目名称:Autopilot,代码行数:8,代码来源:AirVentDepressurize.cs


示例20: InterpreterWeapon

		public InterpreterWeapon(IMyCubeBlock block)
			: base(block as IMyTerminalBlock)
		{
			this.Block = block;
			this.Grid = block.CubeGrid;

			myLogger = new Logger("InterpreterWeapon", () => Grid.DisplayName, () => Block.DefinitionDisplayNameText, () => Block.getNameOnly());
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:8,代码来源:InterpreterWeapon.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
C# IMyCubeGrid类代码示例发布时间:2022-05-24
下一篇:
C# IMyConveyorEndpointBlock类代码示例发布时间: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