Guest User

Untitled

a guest
Oct 20th, 2018
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1. public static nz.sodium.Cell<Axes3D> watchEntityAxes(
  2. nz.sodium.Cell<Option<EcsReadOnlySceneContext>> cSceneCtxOp,
  3. nz.sodium.Stream<EcsSceneChanges> sSceneChanges,
  4. int entityId
  5. ) {
  6. return nz.sodium.Cell.switchC(watchEntityComponentOp(cSceneCtxOp, sSceneChanges, entityId, Axes3DComponent.ecsComponent).lift(
  7. watchEntityComponentOp(cSceneCtxOp, sSceneChanges, entityId, ChildComponent.ecsComponent),
  8. (Option<Axes3DComponent> axesOp, Option<ChildComponent> parentOp) -> {
  9. Option<Integer> parentIdOp = parentOp.map(ChildComponent::parentId);
  10. Axes3D localAxes = axesOp.map(Axes3DComponent::axes3D).orSome(Axes3D.identity);
  11. if (parentIdOp.isNone()) {
  12. return new sodium.Cell<>(localAxes);
  13. } else {
  14. int parentId = parentIdOp.some();
  15. return watchEntityAxes(cSceneCtxOp, sSceneChanges, parentId).map(
  16. (Axes3D parentAxes) ->
  17. parentAxes.fromThisSpace(localAxes)
  18. );
  19. }
  20. }
  21. ));
  22. }
Add Comment
Please, Sign In to add comment