33 lines
637 B
Go
33 lines
637 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 NoTool struct{}
|
|
|
|
func (t *NoTool) Type() string { return "none" }
|
|
|
|
func (t *NoTool) ClickedTile(*Game, geom.Point) {}
|
|
|
|
type ShovelTool struct{}
|
|
|
|
func (t *ShovelTool) Type() string { return "shovel" }
|
|
|
|
func (t *ShovelTool) ClickedTile(game *Game, tile geom.Point) {
|
|
game.Dig(tile)
|
|
}
|