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


C# MyEntity.MoveAndRotate方法代码示例

本文整理汇总了C#中MinerWars.AppCode.Game.Entities.MyEntity.MoveAndRotate方法的典型用法代码示例。如果您正苦于以下问题:C# MyEntity.MoveAndRotate方法的具体用法?C# MyEntity.MoveAndRotate怎么用?C# MyEntity.MoveAndRotate使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在MinerWars.AppCode.Game.Entities.MyEntity的用法示例。


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

示例1: UpdateEntity

 public void UpdateEntity(MyEntity entity)
 {
     Vector3 position;
     Quaternion rotation;
     GetValues(m_time, out position, out rotation);
     entity.MoveAndRotate(position, Matrix.CreateFromQuaternion(rotation));
 }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:7,代码来源:MyEntityAnimator.cs

示例2: UpdateTangent

        public void UpdateTangent(MyEntity entity, Vector3 up)
        {
            Vector3 position0, position1;
            Quaternion rotation0, rotation1;

            GetValues(m_time - 0.05f, out position0, out rotation0);
            GetValues(m_time + 0.05f, out position1, out rotation1);

            Vector3 forward = position1 - position0;
            if (!MyUtils.IsValid(forward))
            {
                forward = entity.WorldMatrix.Forward;
            }

            entity.MoveAndRotate((position0 + position1) / 2, Matrix.CreateWorld(Vector3.Zero, forward, up));
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:16,代码来源:MyEntityAnimator.cs

示例3: MoveAndRotateObject

        /// <summary>
        /// Moves and Rotates entity
        /// </summary>
        /// <param name="newPosition"></param>
        /// <param name="newOrientation"></param>
        /// <param name="entity"></param>
        public static void MoveAndRotateObject(Vector3 newPosition, Matrix newOrientation, MyEntity entity)
        {
            BoundingSphere sphere = new BoundingSphere(newPosition + entity.LocalVolumeOffset, entity.WorldVolume.Radius);

            if (MyMwcSectorConstants.SECTOR_SIZE_FOR_PHYS_OBJECTS_BOUNDING_BOX.Contains(sphere) == MinerWarsMath.ContainmentType.Contains)
            {
                Matrix entityBeforeMoveOrientation = entity.GetWorldRotation();
                Vector3 entityBeforeMovePosition = entity.GetPosition();

                if (entityBeforeMovePosition != newPosition || entityBeforeMoveOrientation != newOrientation)
                {
                    // Move object
                    bool moveSuccesfull = entity.MoveAndRotate(newPosition, newOrientation);
                    Vector3 currentPosition = entity.GetPosition();
                    Matrix currentOrientation = entity.GetWorldRotation();

                    if (moveSuccesfull)
                    {
                        //entity.UpdateWorldMatrix();
                        //  Play movement or rotation sounds
                        if (MyMinerGame.TotalGamePlayTimeInMilliseconds > m_delayMovementSoundInMillis)
                        {
                            if (entityBeforeMovePosition != currentPosition)
                            {
                                MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectMoveStep);
                            }

                            if (entityBeforeMoveOrientation != currentOrientation)
                            {
                                MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectRotateStep);
                            }

                            m_delayMovementSoundInMillis = MyMinerGame.TotalGamePlayTimeInMilliseconds + MyEditorConstants.DELAY_OBJECT_MOVEMENT_SOUND_IN_MILLIS;
                        }

                        MyEditor.Static.RecheckAllColidingEntitesAndClearNonColiding();//check all coliding entites to see if any went out of collision state
                        
                        //MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().StartProfilingBlock("CheckAllCollidingObjectsForEntity");

                        // This was taking up to 170ms for 800 prefabs, so its replaced by void CheckCollisions(IEnumerable<MyEntity> entities) in HandleInput().
                        //MyEditor.Static.CheckAllCollidingObjectsForEntity(entity);//check all colliding state of entity after move

                        //MinerWars.AppCode.Game.Render.MyRender.GetRenderProfiler().EndProfilingBlock(); 
                    }
                    else
                    {
                        if (MyMinerGame.TotalGamePlayTimeInMilliseconds > m_delayMovementSoundInMillis)
                        {
                            if ((entityBeforeMovePosition != currentPosition) || (entityBeforeMoveOrientation != currentOrientation))
                            {
                                MyAudio.AddCue2D(MySoundCuesEnum.GuiEditorObjectMoveInvalid);
                                m_delayMovementSoundInMillis = MyMinerGame.TotalGamePlayTimeInMilliseconds + 1000;
                            }
                        }
                    }

                }
            }
        }
开发者ID:Bunni,项目名称:Miner-Wars-2081,代码行数:65,代码来源:MyEditorGizmo.cs


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