cells now change color based on value!!!

colors are a bit weird though, need to figure that out
This commit is contained in:
Simon O'Shea
2023-08-07 13:59:44 -04:00
parent 94b8f55509
commit 7c3fd8d563
10 changed files with 366 additions and 120 deletions
@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System;
// INSPIRED BY "CODE MONKEY" ON YOUTUBE
@@ -14,10 +15,16 @@ public class LogicGrid
// Actual Grid Array
private int[,] gridArray;
// Debug Grid Array used for updating the text-objects
private TextMesh[,] debugTextArray;
public event EventHandler<OnGridValueChangedEventArgs> OnGridValueChanged;
public class OnGridValueChangedEventArgs : EventArgs
{
public int x;
public int y;
}
public LogicGrid(int width, int height, float cellSize, Vector3 originPosition)
@@ -83,6 +90,14 @@ public class LogicGrid
// Set the value in our debug mesh so that our Text on-screen gets updated
debugTextArray[x, y].text = gridArray[x, y].ToString();
if (OnGridValueChanged != null)
OnGridValueChanged(this, new OnGridValueChangedEventArgs
{
x = x,
y = y
});
;
}
}