diff options
Diffstat (limited to 'order.go')
| -rw-r--r-- | order.go | 13 |
1 files changed, 13 insertions, 0 deletions
@@ -1,5 +1,7 @@ package main +import "age_of_empires/physics" + type Order interface { Update(e *Entity, g *Game) } @@ -10,3 +12,14 @@ func (e *Entity) UpdateOrder(g *Game) { } e.Order.Value.Update(e, g) } + +func (e *Entity) MainAction(g *Game, destination physics.Point, entityAtDestination *Entity, moveMap physics.MoveMap) { + if !e.Selection.IsEnabled || !e.Selection.Value.IsSelected { + return + } + if entityAtDestination != nil && entityAtDestination.ResourceSource.IsEnabled { + Gather(e, entityAtDestination, g) + return + } + physics.StartMove(&e.Move, e.Position, destination, moveMap) +} |
