Beispiel #1
0
    public void StartGame(byte SeaLevel, Texture2D[] landTex, Texture2D[] landnorm, byte[] terrain, byte[] HeightArr, int[,] regIndex, List <Region> region, List <State> st, List <List <Vector2Int> > river)
    {
        MapMetrics.SizeN  = h = regIndex.GetLength(0);
        MapMetrics.SizeM  = w = regIndex.GetLength(1);
        seaLevel          = SeaLevel;
        TerrainMask       = landTex;
        TerrainNormalMask = landnorm;
        terrainIndexes    = terrain;
        River             = river;
        MapMetrics.noise  = noiseSorse;
        MapMetrics.SetSplatMap(new Texture2D(w, h, TextureFormat.RGBA32, false));
        MapMetrics.SetHeights(HeightArr, h, w);
        Navigation.Init(h, w);
        regionIndex = Player.regionIndex = MapMetrics.cellStateIndex = regIndex;

        regions = CameraController.regions = Player.regions =
            MapMetrics.regions = region;
        states = CameraController.state = CodePanel.state = Player.states = st;
        MapMetrics.SeaLevel = seaLevelf = MapMetrics.MaxHeight * SeaLevel / 255f;
        distantion          = new float[h, w];
        parent = new Vector2Int[h, w];
        for (int i = 0; i < h; i++)
        {
            for (int j = 0; j < w; j++)
            {
                distantion[i, j] = -1;//not used
            }
        }
        mapMode = MapMode.None;
        MenuManager.SetMiniMap();

        transform.GetChild(0).transform.position = new Vector3(w / 2, seaLevelf - 0.01f, h / 2);

        CreateWorldBorder();

        BuildWorld();
        CreateTerrain();
        CreateArmy();
        SetMapMode(MapMode.Politic);
        CameraController.SetTarget(st[0].Capital.position);
        MenuManager.StartTimer();
        Player.SetState(st[0]);
    }