当前位置: 首页>>代码示例>>C#>>正文


C# IMyEntity类代码示例

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


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

示例1: ReduceControl

 void IMyPlayerCollection.ReduceControl(IMyControllableEntity entityWhichKeepsControl, IMyEntity entityWhichLoosesControl)
 {
     var e1 = entityWhichKeepsControl as Sandbox.Game.Entities.IMyControllableEntity;
     var e2 = entityWhichLoosesControl as MyEntity;
     if (e1 != null && e2 != null)
         ReduceControl(e1, e2);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyPlayerCollection_ModAPI.cs

示例2: TryExtendControl

 void IMyPlayerCollection.TryExtendControl(IMyControllableEntity entityWithControl, IMyEntity entityGettingControl)
 {
     var e1 = entityWithControl as Sandbox.Game.Entities.IMyControllableEntity;
     var e2 = entityGettingControl as MyEntity;
     if (e1 != null && e2 != null)
         TryExtendControl(e1, e2);
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyPlayerCollection_ModAPI.cs

示例3:

 void Sandbox.ModAPI.Ingame.IMyLargeTurretBase.SetTarget(IMyEntity entity)
 {
     if (entity != null)
     {
         MyMultiplayer.RaiseEvent(this, x => x.SetTargetRequest, entity.EntityId, false);
     } 
 }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:7,代码来源:MyLargeTurretBase_ModAPI.cs

示例4: GetWeaponsTargetingProjectile

		public static short GetWeaponsTargetingProjectile(IMyEntity entity)
		{
			short result;
			if (!WeaponsTargetingProjectile.TryGetValue(entity.EntityId, out result))
				result = 0;
			return result;
		}
开发者ID:helppass,项目名称:Autopilot,代码行数:7,代码来源:TargetingBase.cs

示例5: Use

        public override void Use(UseActionEnum actionEnum, IMyEntity entity)
        {
            var user = entity as MyCharacter;
            var block = Entity as MyCubeBlock;

            if (block != null)
            {
                var relation = block.GetUserRelationToOwner(user.ControllerInfo.ControllingIdentityId);
                if (!relation.IsFriendly())
                {
                    if (user.ControllerInfo.IsLocallyHumanControlled())
                    {
                        MyHud.Notifications.Add(MyNotificationSingletons.AccessDenied);
                    }
                    return;
                }
            }

            switch (actionEnum)
            {
                case UseActionEnum.OpenInventory:
                case UseActionEnum.OpenTerminal:
                    MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Entity);
                    break;
                default:
                    //MyGuiScreenTerminal.Show(MyTerminalPageEnum.Inventory, user, Block);
                    break;
            }
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:29,代码来源:MyUseObjectInventory.cs

示例6: HandleAddDecal

        /// <param name="damage">Not used for now but could be used as a multiplier instead of random decal size</param>
        public static void HandleAddDecal(IMyEntity entity, MyHitInfo hitInfo, MyStringHash source = default(MyStringHash), object customdata = null, float damage = -1)
        {
            IMyDecalProxy proxy = entity as IMyDecalProxy;
            if (proxy != null)
            {
                AddDecal(proxy, ref hitInfo, damage, source, customdata);
                return;
            }

            MyCubeGrid grid = entity as MyCubeGrid;
            if (grid != null)
            {
                var block = grid.GetTargetedBlock(hitInfo.Position);
                if (block != null)
                {
                    var compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                    if (compoundBlock == null)
                        proxy = block;
                    else
                        proxy = compoundBlock;
                }
            }

            if (proxy == null)
                return;

            AddDecal(proxy, ref hitInfo, damage, source, customdata);
        }
开发者ID:ChristianHeinz71,项目名称:SpaceEngineers,代码行数:29,代码来源:MyDecals.cs

示例7: FindPlayer

        private IMyPlayer FindPlayer(IMyEntity entity)
        {
            List<IMyPlayer> players = new List<IMyPlayer>();
            MyAPIGateway.Players.GetPlayers(players);

            double nearestDistance = 5; // usually the distance between player and handtool is about 2 to 3, 5 is plenty 
            IMyPlayer nearestPlayer = null;

            foreach (IMyPlayer player in players)
            {
                var character = player.GetCharacter();
                if (character != null)
                {
                    var distance = (((IMyEntity)character).GetPosition() - entity.GetPosition()).LengthSquared();

                    if (distance < nearestDistance)
                    {
                        nearestDistance = distance;
                        nearestPlayer = player;
                    }
                }
            }

            return nearestPlayer;
        }
开发者ID:Intueor,项目名称:Space-Engineers-Admin-script-mod,代码行数:25,代码来源:HandtoolCache.cs

示例8: HandleAddDecal

        /// <param name="damage">Not used for now but could be used as a multiplier instead of random decal size</param>
        public static void HandleAddDecal(IMyEntity entity, MyHitInfo hitInfo, MyStringHash source = default(MyStringHash), float damage = -1)
        {
            if (entity == null)
                DebugNullEntity();

            IMyDecalProxy proxy = entity as IMyDecalProxy;
            if (proxy != null)
            {
                AddDecal(proxy, ref hitInfo, damage, source);
                return;
            }

            MyCubeGrid grid = entity.GetTopMostParent() as MyCubeGrid;
            if (grid != null)
            {
                var block = grid.GetTargetedBlock(hitInfo.Position);
                if (block != null)
                {
                    var compoundBlock = block.FatBlock as MyCompoundCubeBlock;
                    if (compoundBlock == null)
                        proxy = block;
                    else
                        proxy = compoundBlock;
                }
            }

            if (proxy != null)
                AddDecal(proxy, ref hitInfo, damage, source);
        }
开发者ID:Chrus,项目名称:SpaceEngineers,代码行数:30,代码来源:MyDecals.cs

示例9: MyUseObjectCryoChamberDoor

 public MyUseObjectCryoChamberDoor(IMyEntity owner, string dummyName, MyModelDummy dummyData, uint key)
 {
     CryoChamber = owner as MyCryoChamber;
     Debug.Assert(CryoChamber != null, "MyUseObjectCryoChamberDoor should only be used with MyCryoChamber blocks!");
     
     LocalMatrix = dummyData.Matrix;
 }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:7,代码来源:MyUseObjectCryoChamberDoor.cs

示例10: EntityComponent

 public EntityComponent(IMyEntity entity)
     : base()
 {
     Entity = entity;
     Log = new Logger("SEGarden.Logic.EntityComponent", (() => EntityId.ToString()));
     //Log.Trace("Finished EntityComponent ctr", "ctr");
 }
开发者ID:zrisher,项目名称:SEGarden,代码行数:7,代码来源:EntityComponent.cs

示例11: Character

 public Character(IMyEntity entity)
     : base(entity)
 {
     Log.ClassName = "GP.Concealment.World.Entities.Character";
     Log.Trace("New Character " + Entity.EntityId + " " + DisplayName, "ctr");
     CharacterEntity = Entity as IMyCharacter;
 }
开发者ID:zrisher,项目名称:GardenPerformance,代码行数:7,代码来源:Character.cs

示例12: Waypoint

        public Waypoint(Mover mover, AllNavigationSettings navSet, AllNavigationSettings.SettingsLevelName level, IMyEntity targetEntity, Vector3D worldOffset)
            : base(mover, navSet)
        {
            this.m_logger = new Logger(GetType().Name, m_controlBlock.CubeBlock);
            this.m_level = level;
            this.m_targetEntity = targetEntity;
            this.m_targetOffset = worldOffset;

            m_logger.debugLog(targetEntity != targetEntity.GetTopMostParent(), "targetEntity is not top-most", Logger.severity.FATAL);

            IMyCubeGrid asGrid = targetEntity as IMyCubeGrid;
            if (asGrid != null && Attached.AttachedGrid.IsGridAttached(asGrid, m_controlBlock.CubeGrid, Attached.AttachedGrid.AttachmentKind.Physics))
            {
                m_logger.debugLog("Cannot fly to entity, attached: " + targetEntity.getBestName() + ", creating GOLIS", Logger.severity.WARNING);
                new GOLIS(mover, navSet, TargetPosition, level);
                return;
            }
            if (targetEntity.Physics == null)
            {
                m_logger.debugLog("Target has no physics: " + targetEntity.getBestName() + ", creating GOLIS", Logger.severity.WARNING);
                new GOLIS(mover, navSet, TargetPosition, level);
                return;
            }

            var setLevel = navSet.GetSettingsLevel(level);
            setLevel.NavigatorMover = this;
            //setLevel.DestinationEntity = mover.Block.CubeBlock; // to force avoidance

            m_logger.debugLog("created, level: " + level + ", target: " + targetEntity.getBestName() + ", target position: " + targetEntity.GetPosition() + ", offset: " + worldOffset + ", position: " + TargetPosition, Logger.severity.DEBUG);
        }
开发者ID:Souper07,项目名称:Autopilot,代码行数:30,代码来源:Waypoint.cs

示例13: ProtectedEntity

        private void ProtectedEntity(IMyEntity entity, ProtectedItem item)
        {
            //Logging.WriteLineAndConsole(string.Format("Protecting: {0}", entity.EntityId));
            //CubeGridEntity gridEntity = new CubeGridEntity((MyObjectBuilder_CubeGrid)entity.GetObjectBuilder(), entity);
            CubeGridEntity gridEntity = (CubeGridEntity)GameEntityManager.GetEntity(entity.EntityId);
            MyObjectBuilder_CubeGrid grid = (MyObjectBuilder_CubeGrid)entity.GetObjectBuilder();

            int count = 0;
            while (gridEntity.IsLoading)
            {
                if (count >= 20)
                    return;

                Thread.Sleep(100);
                count++;
            }

            bool found = false;
            /*
            foreach(CubeBlockEntity block in gridEntity.CubeBlocks)
            {
                if (block.IntegrityPercent != item.IntegrityIncrease || block.BuildPercent != item.IntegrityIncrease || block.BoneDamage > 0f)
                {
                    found = true;
                    block.FixBones(0, 100);
                    block.IntegrityPercent = item.IntegrityIncrease;
                    block.BuildPercent = item.IntegrityIncrease;
                }
            }
            */
            if(found)
             			Logging.WriteLineAndConsole(string.Format("Repaired Grid: {0}", gridEntity.EntityId));
        }
开发者ID:afinegan,项目名称:EssentialsPlugin,代码行数:33,代码来源:ProcessProtection.cs

示例14: Process

 private static void Process(IMyEntity entity, MessageSyncEntity syncEntity)
 {
     if (MyAPIGateway.Multiplayer.MultiplayerActive)
         ConnectionHelper.SendMessageToAll(syncEntity);
     else
         syncEntity.CommonProcess(entity);
 }
开发者ID:Intueor,项目名称:Space-Engineers-Admin-script-mod,代码行数:7,代码来源:MessageSyncEntity.cs

示例15:

 void Sandbox.ModAPI.Ingame.IMyLargeTurretBase.SetTarget(IMyEntity entity)
 {
     if (entity != null)
     {
         SyncObject.SendSetTarget(entity.EntityId, false);
     }
 }
开发者ID:caomw,项目名称:SpaceEngineers,代码行数:7,代码来源:MyLargeTurretBase_ModAPI.cs


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