PieManager.cs 1017 Bytes
Newer Older
1
2
3
4
5
6
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class PieManager : MonoBehaviour {

7
    public static int pieCount;
8
9
    public static bool pieInScene = false;
    public static bool start = true;
10
    public static int numTargets;
11

12
13
    private void Update()
    {
astatham's avatar
astatham committed
14
15
        if(pieCount == 0){
            return;
16
17
18
19
20
21
        }
    }

    void Start()
    {
        numTargets = Random.Range(1, 9);
22
23
        pieCount = numTargets * 2;
        PieTarget[] targets = FindObjectsOfType<PieTarget>();
24
25
        for (int i = 0; i < 9 - numTargets; i++)
        {
26
27
28
29
30
31
            int n;
            do
            {
                n = Random.Range(0, 9);
            } while (targets[n].transform.parent.gameObject.activeSelf == false);
            targets[n].transform.parent.gameObject.SetActive(false);
32
        }
astatham's avatar
astatham committed
33
34
        targets[4].gameObject.SetActive(true);
        //gameObject.transform.GetComponent<MovingTarget>().gameObject.SetActive(true);
35
36
    }
}