Newer
Older
AlgebraicDataflowArchitectureModel / GameEngine / resources / GameEngineTest.model
NoranekoFelician 4 days ago 3 KB ・modelファイル出力を更新
init {
player := {
    "transform": {
        "rotation": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        },
        "scale": {
            "x": 1.0,
            "y": 1.0,
            "z": 1.0
        },
        "position": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        }
    },
    "mesh": {
        "sprite": "GameEngine/resources/enemy1.png",
        "type": "sprite"
    }
}
enemy1 := {
    "eid": "1",
    "transform": {
        "rotation": {
            "x": 0.0,
            "y": 0.0,
            "z": 0.0
        },
        "scale": {
            "x": 1.0,
            "y": 1.0,
            "z": 1.0
        },
        "position": {
            "x": 600.0,
            "y": 450.0,
            "z": 0.0
        }
    },
    "mesh": {
        "sprite": "GameEngine/resources/enemy1.png",
        "type": "sprite"
    }
}
}
native channel KeyEvent(kno:Int) {
	 out scene.keys.{kno:Int}.state(curState:Int,keyEvent(nextState)) = nextState
}
native channel SceneUpdateEvent {
	 out scene.time(time:Long,updateEvent(dt:Long)) = (time+dt)
}
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,
    "y": y,
    "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 MoveEnemy1(eid:Str) {
	 in enemy1.transform.position(curPos:Json,moveEnemy1(nextPos,eid)) = nextPos
	 ref enemy1.eid(eid,moveEnemy1(nextPos,eid))
	 out enemy1.transform.position(curPos:Json,moveEnemy1(nextPos,eid)) = 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
}
channel UpdateEnemy1(tid:Str) {
	 in timers.{tid:Str}.count(curCount:Long,updateEnemy1(type,speed)) = nextCount
	 ref enemy1.move.speed(speed:Float,updateEnemy1(type,speed))
	 ref enemy1.move.type(type:Str,updateEnemy1(type,speed))
	 out enemy1.transform.position(curPos:Json,updateEnemy1(type,speed)) = {
    "x": curPos.x,
    "y": (curPos.y+speed),
    "z": curPos.z
}
}
native channel EntitySpriteUpdate(eid:Str) {
	 in scene.entities.{eid:Str}.mesh(curMesh:Json,updateSprite(spritePath:Str)) = {
    "sprite": spritePath,
    "type": "sprite"
}
}
native channel EntityScaleUpdate(eid:Str) {
	 in scene.entities.{eid:Str}.transform.scale(curScale:Json,updateScale(nextScale.x,nextScale.y,nextScale.z)) = nextScale
}
native channel TimersUpdated {
	 in timers(curTimers:Map,update(curTimers,nextTimers)) = nextTimers
}
channel RotateEnemy1(eid:Str) {
	 in enemy1.transform.rotation(curRot:Json,rotateEnemy1(nextRot,eid)) = nextRot
	 ref enemy1.eid(eid,rotateEnemy1(nextRot,eid))
	 out enemy1.transform.rotation(curRot:Json,rotateEnemy1(nextRot,eid)) = nextRot
}
native channel CameraPositionUpdate {
	 in scene.camera.transform.position(curPos:Json,updatePosition(nextPos.x,nextPos.y,nextPos.z)) = nextPos
}
native channel SceneUpdate {
	 in scene(curSc:Json,update(curSc,nextSc)) = nextSc
}
native channel EntityRotationUpdate(eid:Str) {
	 in scene.entities.{eid:Str}.transform.rotation(curRot:Json,updateRotation(nextRot.x,nextRot.y,nextRot.z)) = nextRot
}
native channel CameraRotationUpdate {
	 in scene.camera.transform.rotation(curRot:Json,updateRotation(nextRot.x,nextRot.y,nextRot.z)) = nextRot
}