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.
28 lines
832 B
28 lines
832 B
package wow.doge.mygame.game.subsystems.level
|
|
|
|
import com.jme3.bullet.control.RigidBodyControl
|
|
import com.jme3.light.AmbientLight
|
|
import com.jme3.light.DirectionalLight
|
|
import com.jme3.scene.Spatial
|
|
import com.jme3.bullet.PhysicsSpace
|
|
import cats.effect.concurrent.Ref
|
|
import monix.bio.Task
|
|
import com.jme3.scene.Node
|
|
import wow.doge.mygame.implicits._
|
|
|
|
class GameLevel(
|
|
model: Spatial,
|
|
physicsControl: RigidBodyControl,
|
|
ambientLight: AmbientLight,
|
|
directionalLight: DirectionalLight
|
|
) {
|
|
def addToGame(rootNode: Ref[Task, Node], physicsSpace: PhysicsSpace) = {
|
|
for {
|
|
_ <- rootNode.update(_ :+ model)
|
|
_ <- rootNode.update(_ :+ ambientLight)
|
|
_ <- rootNode.update(_ :+ directionalLight)
|
|
_ <- Task(physicsSpace += model)
|
|
_ <- Task(physicsSpace += physicsControl)
|
|
} yield ()
|
|
}
|
|
}
|