diff --git a/GameEngine/resources/GameEngineTest.model b/GameEngine/resources/GameEngineTest.model index 3199a45..9d48131 100644 --- a/GameEngine/resources/GameEngineTest.model +++ b/GameEngine/resources/GameEngineTest.model @@ -91,17 +91,18 @@ native channel SceneUpdateEvent { out scene.time(time:Long,updateEvent(dt:Long)) = (time+dt) } -channel RotateEnemy(eid:Str) { - in enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot - out enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot -} -channel MoveEnemy(eid:Str) { - in enemies.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos - out scene.entities.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos -} native channel TimerEvent(tid:Str) { out timers.{tid:Str}.count(count:Long,tick()) = (count+1) } +channel ClearTimer { + out timers(timers:Map,clearTimer(tid:Str)) = delete(timers,tid) +} +channel StartTimer { + out timers(timers:Map,startTimer(tid:Str,interval:Long)) = insert(timers,tid,{ + "count": 0, + "interval": interval +}) +} channel UpdateCameraPosition { out scene.camera.transform.position(curPos:Json,updateCameraPosition(x:Double,y:Double,z:Double)) = { "x": x, @@ -109,6 +110,19 @@ "z": z } } +native channel EntityPositionUpdate(eid:Str) { + in scene.entities.{eid:Str}.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos +} +channel MoveEnemy(eid:Str) { + in enemies.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos + out scene.entities.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos +} +native channel CameraProjectionUpdate { + in scene.camera.projection(curProj:Json,updateProjection(curProj,nextProj)) = nextProj +} +native channel CameraScaleUpdate { + in scene.camera.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale +} native channel EntitySpriteUpdate(eid:Str) { in scene.entities.{eid:Str}.mesh(curMesh:Json,updateSprite(spritePath:Str)) = { "sprite": spritePath, @@ -122,15 +136,15 @@ in enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot out enemies.{eid:Str}.transform.rotation(curRot:Json,rotateEnemy(nextRot)) = nextRot } -native channel EntityPositionUpdate(eid:Str) { - in scene.entities.{eid:Str}.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos +channel UpdateEnemy(tid:Str, eid:Str) { + in timers.{tid:Str}.count(curCount:Long,updateEnemy(type,speed)) = nextCount + ref enemies.{eid:Str}.move.speed(speed:Float,updateEnemy(type,speed)) + ref enemies.{eid:Str}.move.type(type:Str,updateEnemy(type,speed)) + out enemies.{eid:Str}.transform.position(curPos:Json,updateEnemy(type,speed)) = { + "x": curPos.x, + "y": (curPos.y+speed), + "z": curPos.z } -channel MoveEnemy(eid:Str) { - in enemies.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos - out scene.entities.{eid:Str}.transform.position(curPos:Json,moveEnemy(nextPos)) = nextPos -} -native channel CameraProjectionUpdate { - in scene.camera.projection(curProj:Json,updateProjection(curProj,nextProj)) = nextProj } native channel TimersUpdated { in timers(curTimers:Map,update(curTimers,nextTimers)) = nextTimers @@ -141,9 +155,6 @@ native channel SceneUpdate { in scene(curSc:Json,update(curSc,nextSc)) = nextSc } -native channel CameraScaleUpdate { - in scene.camera.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale -} native channel EntityRotationUpdate(eid:Str) { in scene.entities.{eid:Str}.transform.rotation(curRot:Json,updateRotation(nextRot.x,nextRot.y,nextRot.z)) = nextRot }