using UnityEngine;
|
|
using TMPro;
|
|
using UnityEngine.UI;
|
|
|
|
public class ColourSquareCollection : MonoBehaviour
|
|
{
|
|
public Texture colouredTexture;
|
|
public GameObject counterScore;
|
|
public GameObject colourCube;
|
|
public Color currentPlayerColour;
|
|
GameObject[] objs;
|
|
Renderer abc;
|
|
int counter = 0;
|
|
|
|
void Start(){
|
|
//have to first get colour from player, hard code purple in at the moment
|
|
colourCube.GetComponent<Image>().color = currentPlayerColour;
|
|
objs = GameObject.FindGameObjectsWithTag("Coloured");
|
|
counter = 1;
|
|
counterScore.GetComponent<TextMeshProUGUI>().text = counter.ToString();
|
|
}
|
|
|
|
public void colourupdatefromMove()
|
|
{
|
|
counter = 1;
|
|
foreach(GameObject a in objs){
|
|
abc = a.GetComponent<Renderer>();
|
|
if (abc.material.GetTexture("_Albedo") == colouredTexture)
|
|
{
|
|
counter++;
|
|
}
|
|
}
|
|
counterScore.GetComponent<TextMeshProUGUI>().text = counter.ToString();
|
|
}
|
|
}
|