Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public static nz.sodium.Cell<Axes3D> watchEntityAxes(
- nz.sodium.Cell<Option<EcsReadOnlySceneContext>> cSceneCtxOp,
- nz.sodium.Stream<EcsSceneChanges> sSceneChanges,
- int entityId
- ) {
- return nz.sodium.Cell.switchC(watchEntityComponentOp(cSceneCtxOp, sSceneChanges, entityId, Axes3DComponent.ecsComponent).lift(
- watchEntityComponentOp(cSceneCtxOp, sSceneChanges, entityId, ChildComponent.ecsComponent),
- (Option<Axes3DComponent> axesOp, Option<ChildComponent> parentOp) -> {
- Option<Integer> parentIdOp = parentOp.map(ChildComponent::parentId);
- Axes3D localAxes = axesOp.map(Axes3DComponent::axes3D).orSome(Axes3D.identity);
- if (parentIdOp.isNone()) {
- return new sodium.Cell<>(localAxes);
- } else {
- int parentId = parentIdOp.some();
- return watchEntityAxes(cSceneCtxOp, sSceneChanges, parentId).map(
- (Axes3D parentAxes) ->
- parentAxes.fromThisSpace(localAxes)
- );
- }
- }
- ));
- }
Add Comment
Please, Sign In to add comment