25 lines
464 B
Go
25 lines
464 B
Go
|
package tins2020
|
||
|
|
||
|
type Tool interface {
|
||
|
Type() string
|
||
|
ClickedTile(*Game, Point)
|
||
|
}
|
||
|
|
||
|
type PlantFlowerTool struct {
|
||
|
FlowerID string
|
||
|
}
|
||
|
|
||
|
func (t *PlantFlowerTool) Type() string { return "plant-flower" }
|
||
|
|
||
|
func (t *PlantFlowerTool) ClickedTile(game *Game, tile Point) {
|
||
|
game.PlantFlower(t.FlowerID, tile)
|
||
|
}
|
||
|
|
||
|
type ShovelTool struct{}
|
||
|
|
||
|
func (t *ShovelTool) Type() string { return "shovel" }
|
||
|
|
||
|
func (t *ShovelTool) ClickedTile(game *Game, tile Point) {
|
||
|
game.Dig(tile)
|
||
|
}
|