blob: 185efdbf55c348a5e53cface11a0962ebbc58157 (
plain) (
blame)
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 main
import (
"age_of_empires/ecs"
"age_of_empires/physics"
"github.com/hajimehoshi/ebiten/v2"
)
type Entity struct {
Position ecs.Component[physics.Point]
Image ecs.Component[*ebiten.Image]
Selection ecs.Component[Selection]
Move ecs.Component[physics.Move]
Order ecs.Component[Order]
ResourceGatherer ecs.Component[ResourceGatherer]
ResourceSource ecs.Component[ResourceSource]
ResourceStorage ecs.Component[ResourceStorage]
Spawn ecs.Component[Spawn]
}
func (e Entity) Bounds() physics.Rectangle {
return physics.Rectangle{
Min: e.Position.Value,
Max: e.Position.Value.Add(e.Image.Value.Bounds().Size()),
}
}
|