[SerializeField] private Dictionary<int, Cell> Cells = new Dictionary<int, Cell>();
[SerializeField] private Dictionary<string, Cell> Prefabs = new Dictionary<string, Cell>();
[SerializeField] private string[] NamePrefabs = new string[4] { "GiftBlue", "GiftGreen", "GiftRed", "GiftYellow" };
void Start(){
GetPrefabs();
CreateBoard();
}
void GetPrefabs(){
foreach(string name in NamePrefabs){
Cell PrefabResources = Resources.Load("Prefabs/" + name, typeof(Cell)) as Cell;
Prefabs[name] = Instantiate(PrefabResources, new Vector3(-10, -10, 0), Quaternion.identity) as Cell;
}
}
void CreateBoard(){
int Num = 0;
for(int y = 0; y < 5; y++){
for(int x = 0; x < 5; x++){
Cells[Num] = Instantiate(Prefabs["GiftRed"], new Vector3(x, y, 0), Quaternion.identity) as Cell;
++Num;
}
}
}