bubbletwist/lib/game/stone/stone.dart

30 lines
601 B
Dart
Raw Normal View History

import 'dart:math';
2024-06-17 16:24:51 +02:00
import '../../enums/stone_color.dart';
/// Class to represent a stone on the board.
class Stone {
/// Color of the stone
late StoneColors stoneColor;
Stone() {
setRandomColor();
}
/// Getter for the color.
/// \return color
StoneColors getStoneColor() => stoneColor;
/// Setter for the color
/// \param color
void setColor(StoneColors stoneColor) {
this.stoneColor = stoneColor;
}
/// method that sets a random color
void setRandomColor() {
stoneColor =
StoneColors.values[Random().nextInt(StoneColors.values.length - 1)];
}
}