Beispiel #1
0
    public void Awake()
    {
        GameOver = false;

        if (instance != null)
        {
            Debug.LogWarning("More than one instance of TheGameManager found!");
            return;
        }
        instance = this;
    }
Beispiel #2
0
    void StartIfRead()
    {
        if (!gameReadyToStart || startCalled)
        {
            return;
        }
        ;

        int numCols = Mathf.FloorToInt(Mathf.Sqrt(numTrainingAreas));

        int row = 0;
        int col = 0;

        if (traingingAreas.Count == 0)
        {
            for (int i = 0; i < numTrainingAreas; i++)
            {
                Debug.Log($"Creating training area {i}");
                GameObject ta = Instantiate(trainingAreaPrefab, new Vector3(0, 0, 0), Quaternion.identity, transform).gameObject;
                ta.transform.SetParent(transform);
                ta.transform.localPosition = new Vector3(col * columns + i % numCols, 0, row);
                SingleGameManager sgm = ta.GetComponentInChildren <SingleGameManager>();

                col++;

                if (col >= numCols)
                {
                    row += rows + 1;
                    col  = 0;
                }

                sgm.DisableStatsOverlay();

                traingingAreas.Add(sgm);
            }
        }

        if (haveAI)
        {
            Academy.Instance.EnvironmentStep();
        }

        startCalled = true;
    }