/
base_game_object.go
69 lines (52 loc) · 1.06 KB
/
base_game_object.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
package core
import (
"github.com/hajimehoshi/ebiten/v2"
"github.com/mymmrac/battleship/data"
)
type BaseGameObject struct {
active bool
visible bool
}
func NewBaseGameObject() BaseGameObject {
return BaseGameObject{
active: false,
visible: false,
}
}
func (o *BaseGameObject) Update(_ data.Point[float32]) {}
func (o *BaseGameObject) Draw(_ *ebiten.Image) {}
func (o *BaseGameObject) Active() bool {
return o.active
}
func (o *BaseGameObject) SetActive(is bool) {
o.active = is
}
func (o *BaseGameObject) Enable() {
o.active = true
}
func (o *BaseGameObject) Disable() {
o.active = false
}
func (o *BaseGameObject) Visible() bool {
return o.visible
}
func (o *BaseGameObject) SetVisible(is bool) {
o.visible = is
}
func (o *BaseGameObject) Show() {
o.visible = true
}
func (o *BaseGameObject) Hide() {
o.visible = false
}
func (o *BaseGameObject) CursorPointer() bool {
return false
}
func (o *BaseGameObject) EnableAndShow() {
o.active = true
o.visible = true
}
func (o *BaseGameObject) DisableAndHide() {
o.active = false
o.visible = false
}