|
|
@ -101,7 +101,10 @@ class MainApp( |
|
|
|
bulletAppState <- Task(new BulletAppState()) |
|
|
|
_ <- Task(stateManager.attach(bulletAppState)) |
|
|
|
_ <- logger.info("Initializing console stream") |
|
|
|
_ <- wire[MainAppDelegate].init(gameApp.scheduler) |
|
|
|
_ <- |
|
|
|
wire[MainAppDelegate] |
|
|
|
.init(gameApp.scheduler) |
|
|
|
.executeOn(gameApp.scheduler) |
|
|
|
} yield gameAppFib |
|
|
|
} |
|
|
|
|
|
|
@ -165,7 +168,6 @@ class MainAppDelegate( |
|
|
|
rootNode, |
|
|
|
bulletAppState.physicsSpace |
|
|
|
) |
|
|
|
.executeOn(appScheduler) |
|
|
|
_ <- createPlayerController(appScheduler) |
|
|
|
.absorbWith(e => DummyException("boom")) |
|
|
|
.onErrorRestart(3) |
|
|
@ -240,55 +242,44 @@ class MainAppDelegate( |
|
|
|
def createTestNpc( |
|
|
|
appScheduler: monix.execution.Scheduler, |
|
|
|
npcName: String |
|
|
|
) = |
|
|
|
// : IO[PlayerController.Error, Unit] = |
|
|
|
{ |
|
|
|
val initialPos = ImVector3f(50, 5, 0) |
|
|
|
// val modelPath = os.rel / "Models" / "Jaime" / "Jaime.j3o" |
|
|
|
val npcPhysicsControl = new BetterCharacterControl(1.5f, 6f, 1f) |
|
|
|
// (1f, 2.1f, 10f) |
|
|
|
.withJumpForce(ImVector3f(0, 5f, 0)) |
|
|
|
// val npcMovementActor = AkkaUtils.spawnActorL2( |
|
|
|
// new NpcMovementActor2.Props( |
|
|
|
// initialPos, |
|
|
|
// tickEventBus, |
|
|
|
// npcPhysicsControl |
|
|
|
// ).behavior, |
|
|
|
// s"${npcName}-npcMovementActor" |
|
|
|
// ) |
|
|
|
val mbNpcNode = PlayerController.Defaults.defaultNpcNode( |
|
|
|
assetManager, |
|
|
|
initialPos, |
|
|
|
npcPhysicsControl, |
|
|
|
npcName |
|
|
|
) |
|
|
|
val npcActorTask = AkkaUtils.spawnActorL( |
|
|
|
NpcActorSupervisor |
|
|
|
.Props( |
|
|
|
new NpcMovementActor.Props( |
|
|
|
enqueueR, |
|
|
|
initialPos, |
|
|
|
// tickEventBus, |
|
|
|
npcPhysicsControl |
|
|
|
).behavior, |
|
|
|
npcName, |
|
|
|
initialPos |
|
|
|
) |
|
|
|
.behavior, |
|
|
|
s"${npcName}-npcActorSupervisor" |
|
|
|
) |
|
|
|
// .taggedWith[PlayerControllerTags.PlayerTag] |
|
|
|
) = { |
|
|
|
val initialPos = ImVector3f(50, 5, 0) |
|
|
|
val npcPhysicsControl = new BetterCharacterControl(1.5f, 6f, 1f) |
|
|
|
// (1f, 2.1f, 10f) |
|
|
|
.withJumpForce(ImVector3f(0, 5f, 0)) |
|
|
|
val mbNpcNode = PlayerController.Defaults.defaultNpcNode( |
|
|
|
assetManager, |
|
|
|
initialPos, |
|
|
|
npcPhysicsControl, |
|
|
|
npcName |
|
|
|
) |
|
|
|
val npcActorTask = AkkaUtils.spawnActorL( |
|
|
|
NpcActorSupervisor |
|
|
|
.Props( |
|
|
|
new NpcMovementActor.Props( |
|
|
|
enqueueR, |
|
|
|
initialPos, |
|
|
|
// tickEventBus, |
|
|
|
npcPhysicsControl |
|
|
|
).behavior, |
|
|
|
npcName, |
|
|
|
initialPos |
|
|
|
) |
|
|
|
.behavior, |
|
|
|
s"${npcName}-npcActorSupervisor" |
|
|
|
) |
|
|
|
// .taggedWith[PlayerControllerTags.PlayerTag] |
|
|
|
|
|
|
|
for { |
|
|
|
npcNode <- IO.fromEither(mbNpcNode) |
|
|
|
npcActor <- npcActorTask |
|
|
|
_ <- IO { |
|
|
|
physicsSpace += npcPhysicsControl |
|
|
|
physicsSpace += npcNode |
|
|
|
rootNode += npcNode |
|
|
|
} |
|
|
|
} yield npcActor |
|
|
|
} |
|
|
|
for { |
|
|
|
npcNode <- IO.fromEither(mbNpcNode) |
|
|
|
npcActor <- npcActorTask |
|
|
|
_ <- IO { |
|
|
|
physicsSpace += npcPhysicsControl |
|
|
|
physicsSpace += npcNode |
|
|
|
rootNode += npcNode |
|
|
|
} |
|
|
|
} yield npcActor |
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|