-
Notifications
You must be signed in to change notification settings - Fork 0
/
components.go
41 lines (30 loc) · 1.39 KB
/
components.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
package main
import (
"github.com/gogue-framework/gogue/ui"
"reflect"
)
// PositionComponent represents a location on the GameMap. An entity must have a PositionComponent to be rendered.
type PositionComponent struct {
X int
Y int
}
func (pc PositionComponent) TypeOf() reflect.Type { return reflect.TypeOf(pc) }
// AppearanceComponent defines what an entity looks like when rendered onto the terminal. It contains a glyph character
// representation, the layer it should be rendered on, and a name and description. An entity must have an appearance
// component to be rendered.
type AppearanceComponent struct {
Glyph ui.Glyph
Layer int
Name string
Description string
}
func (ac AppearanceComponent) TypeOf() reflect.Type { return reflect.TypeOf(ac) }
// MovementComponent is a flag component (no metadata). Its presence on an entity indicates that the entity can freely move
type MovementComponent struct{}
func (mc MovementComponent) TypeOf() reflect.Type { return reflect.TypeOf(mc) }
// BlockingComponent is a flag component that indicates if the entity block movement or not
type BlockingComponent struct {}
func (bc BlockingComponent) TypeOf() reflect.Type { return reflect.TypeOf(bc) }
// SimpeAIComponent is a basic AI. The entity will move randomy around the map.
type SimpleAiComponent struct {}
func (sc SimpleAiComponent) TypeOf() reflect.Type { return reflect.TypeOf(sc) }