123456789101112131415161718192021222324252627282930313233343536373839 |
- package main
- type TileAnimated struct {
- name string
- idx int
- symbols []string
- colors []string
- }
- func (t *TileAnimated) Name() string {
- return t.name
- }
- func (t *TileAnimated) Type() TileType {
- return AnimatedTile
- }
- func (t *TileAnimated) Symbol() string {
- return t.symbols[t.idx]
- }
- func (t *TileAnimated) Color() string {
- return t.colors[t.idx]
- }
- func (t *TileAnimated) Next() {
- t.idx++
- if t.idx >= len(t.symbols) {
- t.idx = 0
- }
- }
- func (t *TileAnimated) ToMap() map[string]any {
- return map[string]any{
- "name": t.name,
- "symbols": t.symbols,
- "colors": t.colors,
- }
- }
|