Beispiel #1
0
    // member functions
    public void StartNewGame(GameSettings settings)
    {
        // delete current grid in the scene & instantiate new grid
        // using the settings that are read from UI Input fields
        Destroy(GameObject.Find("Grid(Clone)"));
        _gridtf = ((GameObject)Instantiate(GridPrefab, new Vector3(0, 0, 0), Quaternion.identity)).transform;
        _grid   = _gridtf.GetComponent <GridScript>();

        _settings = settings;
        _grid.GenerateMap(_settings);    // grid manager "_grid" generates the map with given settings

        // update handles in companion scripts
        GetComponent <PlayerInput>().Grid = _grid;

        ResetGameState();
        UI.ResetHUD(_flagCount);

        GameObject.Find("Skybox Camera").GetComponent <SkyboxScript>().rotation = GetRandomVector();
    }