-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
97 additions
and
19 deletions.
There are no files selected for viewing
10 changes: 10 additions & 0 deletions
10
core/src/me/srikavin/fbla/game/ecs/component/MapTrigger.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package me.srikavin.fbla.game.ecs.component | ||
|
||
import com.artemis.Component | ||
import com.badlogic.gdx.maps.MapProperties | ||
import me.srikavin.fbla.game.trigger.TriggerType | ||
|
||
class MapTrigger : Component() { | ||
lateinit var type: TriggerType | ||
var properties: MapProperties? = null | ||
} |
44 changes: 44 additions & 0 deletions
44
core/src/me/srikavin/fbla/game/ecs/system/TriggerSystem.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package me.srikavin.fbla.game.ecs.system | ||
|
||
import com.artemis.ComponentMapper | ||
import com.artemis.EntitySubscription | ||
import com.artemis.annotations.All | ||
import com.artemis.annotations.Wire | ||
import com.artemis.systems.IteratingSystem | ||
import com.artemis.utils.IntBag | ||
import com.badlogic.gdx.graphics.OrthographicCamera | ||
import com.badlogic.gdx.physics.box2d.World | ||
import ktx.box2d.BodyDefinition | ||
import ktx.box2d.create | ||
import me.srikavin.fbla.game.ecs.component.MapTrigger | ||
|
||
|
||
@All(MapTrigger::class) | ||
class TriggerSystem : IteratingSystem() { | ||
private lateinit var triggerMapper: ComponentMapper<MapTrigger> | ||
|
||
@Wire | ||
lateinit var camera: OrthographicCamera | ||
|
||
@Wire | ||
lateinit var physicsWorld: World | ||
|
||
|
||
override fun initialize() { | ||
super.initialize() | ||
subscription.addSubscriptionListener(object : EntitySubscription.SubscriptionListener { | ||
override fun inserted(entities: IntBag?) { | ||
physicsWorld.create(BodyDefinition().apply { }) | ||
} | ||
|
||
override fun removed(entities: IntBag?) { | ||
} | ||
}) | ||
} | ||
|
||
override fun begin() { | ||
} | ||
|
||
override fun process(entityId: Int) { | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
package me.srikavin.fbla.game.trigger | ||
|
||
enum class TriggerType { | ||
COIN, | ||
TRANSITION | ||
} |