spacetea/simulator/tile.go

28 lines
547 B
Go
Raw Permalink Normal View History

2022-05-17 23:29:59 -04:00
package simulator
2022-05-19 15:18:03 -04:00
import (
"fmt"
)
2022-05-17 23:29:59 -04:00
//Tile is a tile
type Tile struct {
2022-05-25 16:45:23 -04:00
Building item
2022-05-19 17:09:46 -04:00
User *Player
2022-05-17 23:29:59 -04:00
}
2022-05-19 15:18:03 -04:00
func (t *Tile) String() string {
var res string
2022-05-19 17:09:46 -04:00
if t.Building != nil {
2022-05-25 16:45:23 -04:00
if t.Building.Type() == resourceObject {
obj := t.Building.(*Resource)
res += fmt.Sprintf("There is a %v here with value %v\n", obj.Describe(), obj.value)
} else if t.Building.Type() == consumerObject {
obj := t.Building.(*Converter)
res += fmt.Sprintf("There is a %v here\n", obj.Describe())
}
2022-05-19 15:18:03 -04:00
} else {
res += "Nothing here"
}
return res
}