Create All Needed Scripts
This commit is contained in:
27
Assets/Scripts/Models/GameBoard.cs
Normal file
27
Assets/Scripts/Models/GameBoard.cs
Normal file
@@ -0,0 +1,27 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user