本文整理匯總了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;
}