blob: b784c04331e1589628cb8dea06b946bb8aed5bd4 (
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
|
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]
}
func (e Entity) Bounds() physics.Rectangle {
return physics.Rectangle{
Min: e.Position.Value,
Max: e.Position.Value.Add(e.Image.Value.Bounds().Size()),
}
}
|