summaryrefslogtreecommitdiff
path: root/composeApp/src/commonMain/kotlin/coffee/liz/ecs/System.kt
blob: 003292531219657be755c46958418c934aa4f40c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
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,
    )
}