26 lines
760 B
C#
26 lines
760 B
C#
using Models.Interfaces;
|
|
using UnityEngine;
|
|
|
|
namespace Services {
|
|
public class GameBoard : IGameBoard {
|
|
private readonly int height, width;
|
|
public int Height => this.height;
|
|
public int Width => this.width;
|
|
private readonly Gem[,] gemsGrid;
|
|
public Gem[,] GemsGrid => this.gemsGrid;
|
|
|
|
public GameBoard(int width, int height) {
|
|
this.height = height;
|
|
this.width = width;
|
|
this.gemsGrid = new Gem[width, height];
|
|
}
|
|
|
|
public Gem GetGemAt(Vector2Int pos) {
|
|
return this.gemsGrid[pos.x, pos.y];
|
|
}
|
|
|
|
public void SetGemAt(Vector2Int pos, Gem gameObject) {
|
|
this.gemsGrid[pos.x, pos.y] = gameObject;
|
|
}
|
|
}
|
|
} |