本文整理汇总了C#中IMyControllableEntity类的典型用法代码示例。如果您正苦于以下问题:C# IMyControllableEntity类的具体用法?C# IMyControllableEntity怎么用?C# IMyControllableEntity使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IMyControllableEntity类属于命名空间,在下文中一共展示了IMyControllableEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TakeControl
void IMyEntityController.TakeControl(IMyControllableEntity entity)
{
if (entity is Sandbox.Game.Entities.IMyControllableEntity)
{
TakeControl(entity as Sandbox.Game.Entities.IMyControllableEntity);
}
}
示例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;
}
示例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);
}
}
示例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);
}
示例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);
}
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
}
示例10: SetEntity
public new void SetEntity(IMyControllableEntity entity)
{
m_entity = entity as MyShipController;
}
示例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;
}
示例12: sync_UseSuccess
protected virtual void sync_UseSuccess(UseActionEnum actionEnum, IMyControllableEntity user)
{
}
示例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);
}
示例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);
}
示例15: HasExtendedControl
public bool HasExtendedControl(IMyControllableEntity baseEntity, MyEntity secondEntity)
{
return baseEntity.ControllerInfo.Controller == GetEntityController(secondEntity);
}