本文整理汇总了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);
}
}
示例2: OnAdded
public void OnAdded(IEntity entity) {
if (called.Add(entity.UniqueId) == false) {
Console.WriteLine("Called");
}
entity.AddData<DataEmpty>();
entity.Modify<DataEmpty>();
}
示例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
);
}
示例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;
}
}
}
示例5: OnUpdate
public void OnUpdate(IEntity entity) {
if (_enabled == false) {
return;
}
if (entity.Current<TemporaryData>().TicksRemaining <= 0) {
entity.Destroy();
}
entity.Modify<TemporaryData>().TicksRemaining--;
}
示例6: OnRemoved
public void OnRemoved(IEntity entity) {
entity.Modify<DataEmpty>();
}
示例7: OnUpdate
public void OnUpdate(IEntity entity) {
entity.Modify<DataEmpty>();
}
示例8: OnUpdate
public void OnUpdate(IEntity entity) {
for (int i = 0; i < 20; ++i) {
entity.Modify<DataConcurrentVersioned>();
entity.Modify<DataConcurrentNonVersioned>();
}
}