Testing out JmonkeyEngine to make a game in Scala with Akka Actors within a pure FP layer
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 

32 lines
889 B

package wow.doge.mygame.game.subsystems.level
import com.jme3.bullet.PhysicsSpace
import com.jme3.bullet.control.RigidBodyControl
import com.jme3.light.AmbientLight
import com.jme3.light.DirectionalLight
import com.jme3.scene.Node
import com.jme3.scene.Spatial
import com.softwaremill.tagging._
import monix.bio.Task
import wow.doge.mygame.game.GameAppTags
import wow.doge.mygame.implicits._
class GameLevel(
model: Spatial,
physicsControl: RigidBodyControl,
ambientLight: AmbientLight,
directionalLight: DirectionalLight
) {
def addToGame(
rootNode: Node @@ GameAppTags.RootNode,
physicsSpace: PhysicsSpace
) = {
for {
_ <- Task(rootNode += model)
_ <- Task(rootNode :+ ambientLight)
_ <- Task(rootNode :+ directionalLight)
_ <- Task(physicsSpace += model)
_ <- Task(physicsSpace += physicsControl)
} yield ()
}
}