Added score and colors

This commit is contained in:
Furentes
2019-04-11 10:43:44 +02:00
parent dadc790dec
commit 3c8a40bd63
71 changed files with 8358 additions and 137 deletions

View File

@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@ -7,6 +8,9 @@ public class Spawner : MonoBehaviour
{
// Array of groups
public GameObject[] groups;
public TextMeshProUGUI score;
public TextMeshProUGUI overText;
public bool over = false;
// Constructor (called when game starts)
void Start()
@ -17,9 +21,17 @@ public class Spawner : MonoBehaviour
public void spawnNext()
{
score.text = "Score: " + Grid.count;
// Generates random index
int i = Random.Range(0, groups.Length);
// Spawn group at current spawner position
Instantiate(groups[i], transform.position, Quaternion.identity);
if (Group.gameOver) gameOver();
}
public void gameOver()
{
score.text = "GAME OVER";
}
}