Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace BoardGame {
- //TODO UnityEngine.Vector2/UnityEngine.Vector2Int
- public struct Coordinate {
- public int x;
- public int y;
- }
- //TODO UnityEngine.Color
- public struct Color {
- public float r;
- public float g;
- public float b;
- }
- public abstract class Board {
- public delegate void ButtonEventHandler(int x, int y);
- public event ButtonEventHandler OnButtonUp;
- public event ButtonEventHandler OnButtonDown;
- public abstract int Width { get; } //TODO add setter?
- public abstract int Height { get; } //TODO add setter?
- /// <summary>
- /// As communicating with the board hardware may take some time it should only be done
- /// in update. Update then caches all relevant information which can be accessed by the
- /// other methods of this class.
- /// This means Update should not be called every frame but in it´s own loop on a background Thread
- /// </summary>
- public abstract void Update();
- /// <summary>
- /// Turns off all LEDs and resents all button states
- /// </summary>
- public abstract void Reset();
- /// <summary>
- /// Automatically detects the board size.
- /// Time intensive but should only be called once anyway
- /// </summary>
- public abstract void DetectSize();
- public abstract void GetSize(out int width, out int height);
- public abstract void SetSize(int width, int height);
- public abstract void SetLEDColor(Color color, Coordinate coordinate);
- public void SetLEDColor(Color color, IList<Coordinate> coordinates) {
- SetLEDColor(color, coordinates, 0, coordinates.Count);
- }
- public abstract void SetLEDColor(Color color, IList<Coordinate> coordinates, int offset, int count);
- public abstract Color GetLEDColor(Coordinate coordinate);
- /// <summary>
- /// Turns off all LEDs
- /// </summary>
- public abstract void ClearAllLEDS();
- //TODO not sure if they should be used as Board.Update probably should not happen every frame (it´s time intensive)
- public abstract bool GetButton(Coordinate coordinate);
- public abstract bool GetButtonUp(Coordinate coordinate);
- public abstract bool GetButtonDown(Coordinate coordinate);
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement