-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathentityBase.go
115 lines (89 loc) · 2.17 KB
/
entityBase.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
package main
// All entities will have at least this info (implements most of EntityInterface except for Update function)
type EntityBase struct {
key string // this entity's unique key for inserting into map
X float64
Y float64
width float64
height float64
s float64 // speed, how much can move each update (not exported)
vX float64 // current direction vectors (normalized = hypotenuse of 1)
vY float64
K string // what kind of entity
held EntityInterface // should be a pointer reference to an entity, this entity will only be accessed through parent entity
owner EntityInterface // for this entity to use the x, y data from parent entity's Update
room *Room
canChangeRooms bool
}
func (e *EntityBase) Held() EntityInterface {
return e.held
}
func (e *EntityBase) SetHeld(p EntityInterface) {
e.held = p
}
func (e *EntityBase) Owner() EntityInterface {
return e.owner
}
func (e *EntityBase) SetOwner(p EntityInterface) {
e.owner = p
}
func (e *EntityBase) Key() string {
return e.key
}
func (e *EntityBase) GetKind() string {
return e.K
}
func (e *EntityBase) GetX() float64 {
return e.X
}
func (e *EntityBase) SetX(x float64) {
e.X = x
}
func (e *EntityBase) GetY() float64 {
return e.Y
}
func (e *EntityBase) SetY(y float64) {
e.Y = y
}
func (e *EntityBase) GetWidth() float64 {
return e.width
}
func (e *EntityBase) SetWidth(w float64) {
e.width = w
}
func (e *EntityBase) GetHeight() float64 {
return e.height
}
func (e *EntityBase) SetHeight(h float64) {
e.height = h
}
func (e *EntityBase) GetvX() float64 {
return e.vX
}
func (e *EntityBase) SetvX(vX float64) {
e.vX = vX
}
func (e *EntityBase) GetvY() float64 {
return e.vY
}
func (e *EntityBase) SetvY(vY float64) {
e.vY = vY
}
func (e *EntityBase) GetS() float64 {
return e.s
}
func (e *EntityBase) SetS(s float64) {
e.s = s
}
func (e *EntityBase) GetRoom() *Room {
return e.room
}
func (e *EntityBase) SetRoom(r *Room) {
e.room = r
}
func (e *EntityBase) CanChangeRooms() bool {
return e.canChangeRooms
}
func (e *EntityBase) SetCanChangeRooms(b bool) {
e.canChangeRooms = b
}