Commit c27f9839 authored by astatham's avatar astatham
Browse files

Scene spawns with a random number and arrangement of targets, player gets...

Scene spawns with a random number and arrangement of targets, player gets twice as many pies as there are targets
parent 88447b07
......@@ -4,7 +4,7 @@ using UnityEngine;
public class PieManager : MonoBehaviour {
public static int pieCount = 3;
public static int pieCount;
public static bool pieInScene = false;
public static bool start = true;
public static int numTargets;
......@@ -19,10 +19,16 @@ public class PieManager : MonoBehaviour {
void Start()
{
numTargets = Random.Range(1, 9);
pieCount = numTargets * 2;
PieTarget[] targets = FindObjectsOfType<PieTarget>();
for (int i = 0; i < 9 - numTargets; i++)
{
PieTarget target = FindObjectOfType<PieTarget>();
target.transform.parent.gameObject.SetActive(false);
int n;
do
{
n = Random.Range(0, 9);
} while (targets[n].transform.parent.gameObject.activeSelf == false);
targets[n].transform.parent.gameObject.SetActive(false);
}
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment