-
Notifications
You must be signed in to change notification settings - Fork 5
/
system.go
52 lines (43 loc) · 1021 Bytes
/
system.go
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package akara
import "time"
// System describes the bare minimum of what is considered a system
type System interface {
systemInfo
systemControls
Update()
}
type systemControls interface {
systemStatusControls
systemFrequencyControl
}
type systemStatusControls interface {
Active() bool
Activate()
Deactivate()
}
type systemFrequencyControl interface {
Tick()
TickFrequency() float64
TickPeriod() time.Duration
SetTickFrequency(float64)
SetPreTickCallback(func())
SetPostTickCallback(func())
TickCount() uint
}
type systemInfo interface {
Name() string
Uptime() time.Duration
}
type Initializer interface {
Init(*World)
IsInitialized() bool
}
type baseSystem interface {
Init(*World, func())
}
// hasBaseSystem describes a System that is composed of another type of System.
// The Base method returns the System's base system.
// That System's base system can also have its own base system, and so on, creating a composition tree or chain.
type hasBaseSystem interface {
base() baseSystem
}