27 lines
513 B
Go
27 lines
513 B
Go
package tins2020
|
|
|
|
import "opslag.de/schobers/geom"
|
|
|
|
type Tool interface {
|
|
Type() string
|
|
ClickedTile(*Game, geom.Point)
|
|
}
|
|
|
|
type PlantFlowerTool struct {
|
|
FlowerID string
|
|
}
|
|
|
|
func (t *PlantFlowerTool) Type() string { return "plant-flower" }
|
|
|
|
func (t *PlantFlowerTool) ClickedTile(game *Game, tile geom.Point) {
|
|
game.PlantFlower(t.FlowerID, tile)
|
|
}
|
|
|
|
type ShovelTool struct{}
|
|
|
|
func (t *ShovelTool) Type() string { return "shovel" }
|
|
|
|
func (t *ShovelTool) ClickedTile(game *Game, tile geom.Point) {
|
|
game.Dig(tile)
|
|
}
|