public override void Alter(LTimerContext timer) { for (int i = 0; i < keySize; i++) { ActionKey act = (ActionKey)keyActions.Get(i); if (act.IsPressed()) { act.Act(elapsedTime); if (act.isReturn) { return; } } } if (content.IsVisible()) { ProcessEvents(); content.UpdateNode(timer.GetMilliseconds()); } if (follow != null) { foreach (TileMap tile in tiles) { float offsetX = GetHalfWidth() - follow.GetX(); offsetX = MathUtils.Min(offsetX, 0); offsetX = MathUtils.Max(offsetX, GetWidth() - tile.GetWidth()); float offsetY = GetHalfHeight() - follow.GetY(); offsetY = MathUtils.Min(offsetY, 0); offsetY = MathUtils .Max(offsetY, GetHeight() - tile.GetHeight()); SetOffset(tile, offsetX, offsetY); tile.Update(elapsedTime); } } foreach (SpriteBatchObject o in objects) { o.Update(elapsedTime); if (updateListener != null) { updateListener.Act(o, elapsedTime); } } Update(elapsedTime); Commits(); }
public override void Alter(LTimerContext timer) { for (int i = 0; i < keySize; i++) { ActionKey act = (ActionKey)keyActions.Get(i); if (act.IsPressed()) { act.Act(elapsedTime); if (act.isReturn) { return; } } } if (content.IsVisible()) { ProcessEvents(); content.UpdateNode(timer.GetMilliseconds()); } if (usePhysics) { if (_dt < 0) { _manager.Step(timer.GetMilliseconds()); } else { _manager.Step(_dt); } } if (follow != null) { if (usePhysics) { _manager.Offset(follow.GetX(), follow.GetY()); } foreach (TileMap tile in tiles) { float offsetX = GetHalfWidth() - follow.GetX(); offsetX = MathUtils.Min(offsetX, 0); offsetX = MathUtils.Max(offsetX, GetWidth() - tile.GetWidth()); float offsetY = GetHalfHeight() - follow.GetY(); offsetY = MathUtils.Min(offsetY, 0); offsetY = MathUtils .Max(offsetY, GetHeight() - tile.GetHeight()); SetOffset(tile, offsetX, offsetY); tile.Update(elapsedTime); } } foreach (SpriteBatchObject o in objects) { if (usePhysics) { PBody body = (PBody)CollectionUtils.Get(_Bodys, o); if (body != null) { PShape shape = body.Inner_shapes()[0]; float rotation = (shape.GetAngle() * MathUtils.RAD_TO_DEG) % 360; AABB aabb = shape.GetAABB(); o.SetLocation(_manager.GetScreenX(aabb.minX), _manager.GetScreenY(aabb.minY)); o.SetRotation(rotation); } } o.Update(elapsedTime); if (updateListener != null) { updateListener.Act(o, elapsedTime); } } Update(elapsedTime); Commits(); }