本文整理汇总了C#中MinerWars.AppCode.Game.Entities.MyEntity.SetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntity.SetPosition方法的具体用法?C# MyEntity.SetPosition怎么用?C# MyEntity.SetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类MinerWars.AppCode.Game.Entities.MyEntity
的用法示例。
在下文中一共展示了MyEntity.SetPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MoveMotherShipForward
bool MoveMotherShipForward(MyEntity entity, float speed, Vector3 destination)
{
Vector3 velocity = speed * entity.WorldMatrix.Forward; // Speed in direction
if (Vector3.DistanceSquared(destination, entity.GetPosition()) > 10 * 10)
{
entity.SetPosition(entity.GetPosition() + velocity * MyConstants.PHYSICS_STEP_SIZE_IN_SECONDS); // recalculate position
return false;
}
return true;
}
示例2: MoveEntityToHangar
private static void MoveEntityToHangar(MyEntity entity, float offset)
{
MyEntity hangarEntity;
MyEntities.TryGetEntityByName(MyMissionLocation.MADELYN_HANGAR, out hangarEntity);
MyPrefabHangar madelynHangar = hangarEntity as MyPrefabHangar;
if (madelynHangar != null)
{
entity.SetPosition(madelynHangar.WorldVolume.Center - offset * madelynHangar.WorldMatrix.Forward);
}
}
示例3: addEntity
MyEntity addEntity(MyEntity entity, ref Vector3 currentPosition, Vector3 forward)
{
float offset = (entity.WorldAABB.Max - entity.WorldAABB.Min).Length() / 2.0f + 15;
currentPosition += forward * offset;
Matrix mat = Matrix.CreateTranslation(entity.LocalVolumeOffset) * entity.WorldMatrix;
entity.SetPosition(currentPosition - mat.Translation);
currentPosition += forward * offset;
return entity;
}