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.softwaremill.tagging._
import monix.bio.Task
import wow.doge.mygame.game.GameAppTags
// import wow.doge.mygame.implicits._
import wow.doge.mygame.utils.wrappers.jme.AppNode
import wow.doge.mygame.utils.wrappers.jme.PhysicsSpace

class GameLevel(
    model: Spatial,
    physicsControl: RigidBodyControl,
    ambientLight: AmbientLight,
    directionalLight: DirectionalLight
) {
  def addToGame(
      rootNode: AppNode[Task] @@ GameAppTags.RootNode,
      physicsSpace: PhysicsSpace[Task]
  ) = {
    for {
      _ <- rootNode += model
      _ <- rootNode += ambientLight
      _ <- rootNode += directionalLight
      _ <- physicsSpace += model
      _ <- physicsSpace += physicsControl
    } yield ()
  }
}
