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


C# IEntity.Modify方法代码示例

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


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

示例1: RespondToMapBounds

        /// <summary>
        /// Changes an objects velocity if it has left the map.
        /// </summary>
        private static void RespondToMapBounds(MapBoundsData mapBounds, IEntity entity) {
            PositionData pos = entity.Current<PositionData>();
            MovementData mov = entity.Current<MovementData>();

            if (((pos.Position.Z - pos.Position.Radius) < -mapBounds.Height && mov.Velocity.Z < 0) ||
                ((pos.Position.Z + pos.Position.Radius) > mapBounds.Height && mov.Velocity.Z > 0)) {
                entity.Modify<MovementData>().MultVelocity(1, -1);
            }
            if (((pos.Position.X - pos.Position.Radius) < -mapBounds.Width && mov.Velocity.X < 0) ||
                ((pos.Position.X + pos.Position.Radius) > mapBounds.Width && mov.Velocity.X > 0)) {
                entity.Modify<MovementData>().MultVelocity(-1, 1);
            }
        }
开发者ID:jyunfan2015,项目名称:forge-sample,代码行数:16,代码来源:MovementSystem.cs

示例2: OnAdded

 public void OnAdded(IEntity entity) {
     if (called.Add(entity.UniqueId) == false) {
         Console.WriteLine("Called");
     }
     entity.AddData<DataEmpty>();
     entity.Modify<DataEmpty>();
 }
开发者ID:jyunfan2015,项目名称:forge,代码行数:7,代码来源:CallOrderTests.cs

示例3: IntegratePosition

        /// <summary>
        /// Moves an object to its next position according to its current velocity.
        /// </summary>
        private static void IntegratePosition(IEntity entity) {
            PositionData pos = entity.Current<PositionData>();
            MovementData mov = entity.Current<MovementData>();

            entity.Modify<PositionData>().Position = new Bound(
                pos.Position.X + mov.Velocity.X,
                pos.Position.Z + mov.Velocity.Z,
                pos.Position.Radius
            );
        }
开发者ID:jyunfan2015,项目名称:forge-sample,代码行数:13,代码来源:MovementSystem.cs

示例4: OnUpdate

        public void OnUpdate(IEntity ball) {
            // If we just modified the velocity of the ball, then don't modify it again until the
            // cooldown has finished.
            if (ball.Current<BallData>().CollisionDisabled > 0) {
                ball.Modify<BallData>().CollisionDisabled--;
                return;
            }

            foreach (IEntity paddle in _paddles.Paddles) {
                Bound paddlePosition = paddle.Current<PositionData>().Position;
                Bound ballPosition = ball.Current<PositionData>().Position;

                // change the direction of the ball if it's colliding with a paddle
                if (paddlePosition.Intersects(ballPosition)) {
                    ball.Modify<MovementData>().MultVelocity(-1, 1);
                    ball.Modify<BallData>().CollisionDisabled = 5;
                    break;
                }
            }
        }
开发者ID:jyunfan2015,项目名称:forge-sample,代码行数:20,代码来源:BallCollisionSystem.cs

示例5: OnUpdate

        public void OnUpdate(IEntity entity) {
            if (_enabled == false) {
                return;
            }

            if (entity.Current<TemporaryData>().TicksRemaining <= 0) {
                entity.Destroy();
            }

            entity.Modify<TemporaryData>().TicksRemaining--;
        }
开发者ID:jyunfan2015,项目名称:forge-sample,代码行数:11,代码来源:TemporarySystem.cs

示例6: OnRemoved

 public void OnRemoved(IEntity entity) {
     entity.Modify<DataEmpty>();
 }
开发者ID:jyunfan2015,项目名称:forge,代码行数:3,代码来源:CallOrderTests.cs

示例7: OnUpdate

 public void OnUpdate(IEntity entity) {
     entity.Modify<DataEmpty>();
 }
开发者ID:jyunfan2015,项目名称:forge,代码行数:3,代码来源:CallOrderTests.cs

示例8: OnUpdate

 public void OnUpdate(IEntity entity) {
     for (int i = 0; i < 20; ++i) {
         entity.Modify<DataConcurrentVersioned>();
         entity.Modify<DataConcurrentNonVersioned>();
     }
 }
开发者ID:jyunfan2015,项目名称:forge,代码行数:6,代码来源:EngineTests.cs


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