tins2020/tools.go

33 lines
637 B
Go
Raw Normal View History

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)
}
2020-05-23 10:34:17 +00:00
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)
}