27 lines
811 B
C#
27 lines
811 B
C#
using Models.Interfaces;
|
|
using UnityEngine;
|
|
|
|
namespace Services {
|
|
public class GameBoard : IGameBoard {
|
|
private int height, width;
|
|
public int Height => this.height;
|
|
public int Width => this.width;
|
|
private 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) {
|
|
Gem gameObject = this.gemsGrid[pos.x, pos.y];
|
|
return gameObject != null ? gameObject : null;
|
|
}
|
|
|
|
public void SetGemAt(Vector2Int pos, Gem gameObject) {
|
|
this.gemsGrid[pos.x, pos.y] = gameObject;
|
|
}
|
|
}
|
|
} |