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

C# IMyControllableEntity类代码示例

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

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



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

示例1: TakeControl

 void IMyEntityController.TakeControl(IMyControllableEntity entity)
 {
     if (entity is Sandbox.Game.Entities.IMyControllableEntity)
     {
         TakeControl(entity as Sandbox.Game.Entities.IMyControllableEntity);
     }
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:7,代码来源:MyEntityController_ModAPI.cs


示例2: FindLookAtEntity

 public static IMyEntity FindLookAtEntity(IMyControllableEntity controlledEntity, bool findShips, bool findCubes, bool findPlayers, bool findAsteroids, bool findPlanets, bool findReplicable)
 {
     IMyEntity entity;
     double distance;
     Vector3D hitPoint;
     FindLookAtEntity(controlledEntity, true, false, out entity, out distance, out hitPoint, findShips, findCubes, findPlayers, findAsteroids, findPlanets, findReplicable);
     return entity;
 }
开发者ID:Intueor,项目名称:Space-Engineers-Admin-script-mod,代码行数:8,代码来源:Support.cs


示例3: SwitchControl

        public static void SwitchControl(this IMyControllableEntity entity, IMyControllableEntity newControlledEntity)
        {
            Debug.Assert(entity != null, "Entity is null");
            Debug.Assert(entity.ControllerInfo.Controller != null, "Entity is not controlled");

            if (entity.ControllerInfo.Controller != null)
            {
                entity.ControllerInfo.Controller.TakeControl(newControlledEntity);
            }
        }
开发者ID:fluxit,项目名称:SpaceEngineers,代码行数:10,代码来源:IMyControllableEntity.cs


示例4: TakeControl

        public void TakeControl(IMyControllableEntity entity)
        {
            if (ControlledEntity == entity)
                return;

            if (entity != null && entity.ControllerInfo.Controller != null)
            {
                Debug.Fail("Entity controlled by another controller, release it first");
                return;
            }

            var old = ControlledEntity;

            if (old != null)
            {
                var entityCameraSettings = old.GetCameraEntitySettings();

                float headLocalXAngle = old.HeadLocalXAngle;
                float headLocalYAngle = old.HeadLocalYAngle;

                old.Entity.OnClosing -= m_controlledEntityClosing;
                old.ControllerInfo.Controller = null; // This will call OnControlReleased
                ControlledEntity = null;

                bool firstPerson = entityCameraSettings != null? entityCameraSettings.IsFirstPerson : (MySession.Static.GetCameraControllerEnum() != MyCameraControllerEnum.ThirdPersonSpectator);

                if (!MySandboxGame.IsDedicated)
                {
                    MySession.Static.Cameras.SaveEntityCameraSettings(
                        Player.Id,
                        old.Entity.EntityId,
                        firstPerson,
                        MyThirdPersonSpectator.Static.GetDistance(),
                        headLocalXAngle,
                        headLocalYAngle);
                }

            }
            if (entity != null)
            {
                ControlledEntity = entity;
                ControlledEntity.Entity.OnClosing += m_controlledEntityClosing;
                ControlledEntity.ControllerInfo.Controller = this; // This will call OnControlAcquired

                if (!MySandboxGame.IsDedicated && ControlledEntity.Entity is Sandbox.ModAPI.Interfaces.IMyCameraController)
                {
                    MySession.Static.SetEntityCameraPosition(Player.Id, ControlledEntity.Entity);
                }
            }

            if (old != entity)
                RaiseControlledEntityChanged(old, entity);
        }
开发者ID:stanhebben,项目名称:SpaceEngineers,代码行数:53,代码来源:MyEntityController.cs


示例5: OpenControlMenu

        public void OpenControlMenu(IMyControllableEntity controlledEntity)
        {
            m_controlMenu = null;

            if (controlledEntity is MyCharacter)
            {
                SetupCharacterScreen(controlledEntity as MyCharacter);
            }
            else if (controlledEntity is MyShipController)
            {
                SetupSpaceshipScreen(controlledEntity as MyShipController);
            }

            if (IsControlMenuInitialized)
            {
                m_controlMenu.RecreateControls(false);
                MyGuiSandbox.AddScreen(MyGuiScreenGamePlay.ActiveGameplayScreen = m_controlMenu);
            }
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:19,代码来源:MySpaceControlMenuInitializer.cs


示例6: DroneNavigation

        public DroneNavigation(IMyCubeGrid ship, IMyControllableEntity shipControls,
            List<IMyEntity> nearbyFloatingObjects, double maxEngagementRange)
        {
            //stuff passed from sip
            _shipControls = shipControls;
            Ship = ship;
            GridTerminalSystem = MyAPIGateway.TerminalActionsHelper.GetTerminalSystemForGrid(ship);
            _nearbyFloatingObjects = nearbyFloatingObjects;

            var value = (ship.LocalAABB.Max - ship.LocalAABB.Center).Length();

            if (ship.Physics.Mass > 100000)
                FollowRange = 600 + value;
            else
                FollowRange = 400 + value;

            ShipOrientation();
            FindGyros();

            _initialized = true;
        }
开发者ID:ESearcy,项目名称:PVE-AI-Drones-Drone-Conquest,代码行数:21,代码来源:DroneNavigation.cs


示例7: CheckPreviousEntity

        private bool CheckPreviousEntity(IMyControllableEntity entity)
        {
            if (entity is MyCharacter)
            {
                return true;
            }

            if (entity is MyCryoChamber)
            {
                return false;
            }
            
            if (entity is MyCockpit)
            {
                return true;
            }

            return false;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:19,代码来源:MyRemoteControl.cs


示例8: AcquireControl

        private void AcquireControl(IMyControllableEntity previousControlledEntity)
        {
            if (!CheckPreviousEntity(previousControlledEntity))
            {
                return;
            }

            if (m_autoPilotEnabled)
            {
                SetAutoPilotEnabled(false);
            }

            PreviousControlledEntity = previousControlledEntity;
            var shipController = (PreviousControlledEntity as MyShipController);
            if (shipController != null)
            {
                m_enableFirstPerson = shipController.EnableFirstPerson;
                cockpitPilot = shipController.Pilot;
                if (cockpitPilot != null)
                {
                    cockpitPilot.CurrentRemoteControl = this;
                }
            }
            else
            {
                m_enableFirstPerson = true;

                var character = PreviousControlledEntity as MyCharacter;
                if (character != null)
                {
                    character.CurrentRemoteControl = this;
                }
            }

            //MySession.Static.SetCameraController(MyCameraControllerEnum.Entity, this);

            if (MyCubeBuilder.Static.IsActivated)
            {
                //MyCubeBuilder.Static.Deactivate();
                MySession.Static.GameFocusManager.Clear();
            }

            UpdateEmissivity();
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:44,代码来源:MyRemoteControl.cs


示例9: ChangeEntity

 public void ChangeEntity(IMyControllableEntity newEntity)
 {
     m_entity = newEntity == null ? null : newEntity.Entity;
     if (m_entity != null)
     {
         m_forwardVector = PositionAndOrientation.Forward;
         m_upVector = PositionAndOrientation.Up;
         m_speed = 0.0f;
         m_rotationSpeedModifier = 1;
     }
 }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:11,代码来源:MyBotNavigation.cs


示例10: SetEntity

 public new void SetEntity(IMyControllableEntity entity)
 {
     m_entity = entity as MyShipController;
 }
开发者ID:austusross,项目名称:SpaceEngineers,代码行数:4,代码来源:MySpaceControlHelpers.cs


示例11: CanUse

        public virtual UseActionResult CanUse(UseActionEnum actionEnum, IMyControllableEntity user)
        {
            if (m_pilot != null)
                return UseActionResult.UsedBySomeoneElse;

            if (!IsFunctional)
                return UseActionResult.CockpitDamaged;

            long identityId = user.ControllerInfo.ControllingIdentityId;
            if (identityId != 0)
            {
                bool accessAllowed = HasPlayerAccess(identityId);
                if (!accessAllowed)
                    return UseActionResult.AccessDenied;

                return UseActionResult.OK;
            }

            return UseActionResult.AccessDenied;
        }
开发者ID:Rynchodon,项目名称:SpaceEngineers,代码行数:20,代码来源:MyCockpit.cs


示例12: sync_UseSuccess

 protected virtual void sync_UseSuccess(UseActionEnum actionEnum, IMyControllableEntity user)
 {
 }
开发者ID:notten,项目名称:SpaceEngineers,代码行数:3,代码来源:MyShipController.cs


示例13: CheckRangeAndAccess

        private bool CheckRangeAndAccess(IMyControllableEntity controlledEntity, MyPlayer player)
        {
            var terminal = controlledEntity as MyTerminalBlock;
            if (terminal == null)
            {
                var character = controlledEntity as MyCharacter;
                if (character != null)
                {
                    return MyAntennaSystem.Static.CheckConnection(character, CubeGrid, player);
                }
                else
                {
                    return true;
                }
            }

            MyCubeGrid playerGrid = terminal.SlimBlock.CubeGrid;

            return MyAntennaSystem.Static.CheckConnection(playerGrid, CubeGrid, player);
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:20,代码来源:MyRemoteControl.cs


示例14: controller_ControlledEntityChanged

        private void controller_ControlledEntityChanged(IMyControllableEntity oldEntity, IMyControllableEntity newEntity)
        {
            Debug.Assert(oldEntity != null || newEntity != null, "Both old and new entity cannot be null!");
            Debug.Assert(oldEntity == null || oldEntity.ControllerInfo.Controller == null, "Inconsistency! Controller of old entity is not empty!");
            Debug.Assert(oldEntity == null || m_controlledEntities.ContainsKey((oldEntity as MyEntity).EntityId), "Old entity control not in controller collection!");
            Debug.Assert(newEntity == null || !m_controlledEntities.ContainsKey((newEntity as MyEntity).EntityId), "New entity control is already in the controller collection!");

            var controller = (newEntity == null ? oldEntity.ControllerInfo.Controller : newEntity.ControllerInfo.Controller);

            if (oldEntity != null)
                m_controlledEntities.Remove((oldEntity as MyEntity).EntityId, immediate: true);
            if (newEntity != null)
                m_controlledEntities.Add((newEntity as MyEntity).EntityId, controller.Player.Id, immediate: true);
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:14,代码来源:MyPlayerCollection.cs


示例15: HasExtendedControl

 public bool HasExtendedControl(IMyControllableEntity baseEntity, MyEntity secondEntity)
 {
     return baseEntity.ControllerInfo.Controller == GetEntityController(secondEntity);
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:4,代码来源:MyPlayerCollection.cs


示例16: ReduceAllControl

        public void ReduceAllControl(IMyControllableEntity baseEntity)
        {
            MyPlayer.PlayerId playerId;
            bool success = m_controlledEntities.TryGetValue(baseEntity.Entity.EntityId, out playerId);
            Debug.Assert(success, "Could not get the controller of the base entity!");
            if (!success) return;

            foreach (var entry in m_controlledEntities)
            {
                if (entry.Value != playerId) continue; // Only take entities controlled by the same controller as baseEntity
                if (entry.Key == baseEntity.Entity.EntityId) continue; // But don't reduce control from the base entity itself

                MyEntity entity = null;
                MyEntities.TryGetEntity(entry.Key, out entity);
                Debug.Assert(entity != null, "Could not find controlled entity!");
                if (entity == null) continue;

                RemoveControlledEntityProxy(entity, immediateOnServer: false);
            }
            m_controlledEntities.ApplyRemovals();

            WriteDebugInfo();
        }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:23,代码来源:MyPlayerCollection.cs


示例17: ReduceControl

 public void ReduceControl(IMyControllableEntity baseEntity, MyEntity entityWhichLoosesControl)
 {
     if (!TryReduceControl(baseEntity, entityWhichLoosesControl))
     {
         Debug.Fail("Both entities must be controlled by same player");
     }
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:7,代码来源:MyPlayerCollection.cs


示例18: TryReduceControl

 public bool TryReduceControl(IMyControllableEntity baseEntity, MyEntity entityWhichLoosesControl)
 {
     MyPlayer.PlayerId playerB;
     var controller = baseEntity.ControllerInfo.Controller;
     if (controller != null && m_controlledEntities.TryGetValue(entityWhichLoosesControl.EntityId, out playerB) && controller.Player.Id == playerB)
     {
         RemoveControlledEntity(entityWhichLoosesControl);
         return true;
     }
     return false;
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:11,代码来源:MyPlayerCollection.cs


示例19: ExtendControl

 public void ExtendControl(IMyControllableEntity baseEntity, MyEntity entityGettingControl)
 {
     var controller = baseEntity.ControllerInfo.Controller;
     if (controller != null)
     {
         // This can fail when something else is controlling entityGettingControl
         // This is case when player entered second cockpit (and first cockpit is controlled by someone)
         TrySetControlledEntity(controller.Player.Id, entityGettingControl);
     }
     else
     {
         Debug.Fail("'entityWithControl' is not controlled");
     }
 }
开发者ID:leandro1129,项目名称:SpaceEngineers,代码行数:14,代码来源:MyPlayerCollection.cs


示例20: ReturnControl

        private void ReturnControl(IMyControllableEntity nextControllableEntity)
        {
            //Check if it was already switched by server
            if (ControllerInfo.Controller != null)
            {            
                this.SwitchControl(nextControllableEntity);
            }

            PreviousControlledEntity = null;
        }
开发者ID:2asoft,项目名称:SpaceEngineers,代码行数:10,代码来源:MyRemoteControl.cs



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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