summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/ecs/System.kt
blob: e763c9c47fb1e684474b0402097655b02914577a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
package coffee.liz.ecs

import kotlin.reflect.KClass
import kotlin.time.Duration

/**
 * System is a component that updates the world state.
 * @param Outside is the state of the stuff outside the world (input, etc.).
 */
interface System<Outside> {
    /**
     * Systems that must run before this system in the update loop.
     */
    val dependencies: Set<KClass<out System<*>>>
        get() = emptySet()

    /**
     * Integrate this system over [deltaTime].
     * @param world [World]
     * @param deltaTime [Duration] since last update
     */
    fun update(world: World<Outside>, state: Outside, deltaTime: Duration)
}