Пример #1
0
    void Start()
    {
        game         = false;
        gameOver     = false;
        app          = GameObject.Find("__app");
        appScript    = app.GetComponent <__app>();
        HPText.text  = HP.ToString();
        gameOverText = "";
        Currency     = __app.baseCurrency;

        // Load Level
        level = Resources.Load("Prefabs/Levels/" + appScript.getLevel()) as GameObject;
        Instantiate(level);

        // Find and load waypoints
        GameObject[] foundWaypoints = GameObject.FindGameObjectsWithTag("Waypoint");
        waypoints = new GameObject[foundWaypoints.Length];
        // Debug.Log("Waypoints: " + foundWaypoints.Length.ToString());
        for (int i = 0; i < foundWaypoints.Length; i++)
        {
            foreach (GameObject way in foundWaypoints)
            {
                if (way.name == "Waypoint" + i.ToString())
                {
                    waypoints[i] = way;
                }
            }
        }

        startGame();
        startNextWave = false;
    }