コード例 #1
0
        /// <summary>
        /// Bind method implementation
        /// </summary>
        public void Bind()
        {
            if (_isbinded)
            {
                return;
            }
            _isbinded = true;

            Forests.Clear();
            Forest currentforest = Forest.GetCurrentForest();

            ADDSForest root = new ADDSForest();

            root.IsRoot    = true;
            root.ForestDNS = currentforest.Name;
            Forests.Add(root);
            foreach (ForestTrustRelationshipInformation trusts in currentforest.GetAllTrustRelationships())
            {
                ADDSForest sub = new ADDSForest();
                sub.IsRoot    = false;
                sub.ForestDNS = trusts.TargetName;
                foreach (TopLevelName t in trusts.TopLevelNames)
                {
                    if (t.Status == TopLevelNameStatus.Enabled)
                    {
                        sub.TopLevelNames.Add(t.Name);
                    }
                }
                Forests.Add(sub);
            }
        }
コード例 #2
0
    void GenerateForests()
    {
        forests = new Forests[TreePieces.Randomize];

        for (int i = 0; i < forests.Length; i++)
        {
            forests[i] = new Forests();
            forests[i].SetUpForests(TreeXCoord.Randomize, TreeZCoord.Randomize, TreeLength.Randomize, TreeWidth.Randomize);

            for (int x = 0; x < forests[i].forestLength; x++)
            {
                int xCoord = forests[i].xPos + x;

                for (int z = 0; z < forests[i].forestHeight; z++)
                {
                    int zCoord = forests[i].zPos + z;
                    grid[xCoord, zCoord].tree = true;
                }
            }
        }
    }
コード例 #3
0
        public void FillTo(Generation.World.TimelineLayer component)
        {
            component.Age = Age;

            component.WorldTiles = new Generation.World.WorldTile[WorldMapResolution, WorldMapResolution];

            for (int i = 0; i < WorldMapResolution; i++)
            {
                for (int j = 0; j < WorldMapResolution; j++)
                {
                    component.WorldTiles[i, j] = WorldTiles[i * WorldMapResolution + j];
                }
            }

            component.Civilizations = new List <Generation.World.Civilization>(Civilizations.Select(x => (Generation.World.Civilization)x));

            component.Continents = new List <Generation.World.Region>(Continents.Select(x => (Generation.World.Region)x));

            component.Islands = new List <Generation.World.Region>(Islands.Select(x => (Generation.World.Region)x));

            component.Mountains = new List <Generation.World.Region>(Mountains.Select(x => (Generation.World.Region)x));

            component.Forests = new List <Generation.World.Region>(Forests.Select(x => (Generation.World.Region)x));

            component.Deserts = new List <Generation.World.Region>(Deserts.Select(x => (Generation.World.Region)x));

            component.Swamps = new List <Generation.World.Region>(Swamps.Select(x => (Generation.World.Region)x));

            component.Chunks = Chunks;

            component.ElevationMap = new float[WorldMapResolution][];
            for (int i = 0; i < WorldMapResolution; i++)
            {
                component.ElevationMap[i] = new float[WorldMapResolution];
                for (int j = 0; j < WorldMapResolution; j++)
                {
                    component.ElevationMap[i][j] = ElevationMap[i * WorldMapResolution + j] / 255f;
                }
            }

            component.RiverMap = new bool[WorldMapResolution][];
            for (int i = 0; i < WorldMapResolution; i++)
            {
                component.RiverMap[i] = new bool[WorldMapResolution];
                for (int j = 0; j < WorldMapResolution; j++)
                {
                    component.RiverMap[i][j] = RiverMap[i * WorldMapResolution + j];
                }
            }


            component.RiverBorderMap = new bool[WorldMapResolution][];
            for (int i = 0; i < WorldMapResolution; i++)
            {
                component.RiverBorderMap[i] = new bool[WorldMapResolution];
                for (int j = 0; j < WorldMapResolution; j++)
                {
                    component.RiverBorderMap[i][j] = RiverBorderMap[i * WorldMapResolution + j];
                }
            }

            component.InlandWaterConnectivity = new TileForInlandWaterConnectivity[WorldMapResolution][];
            for (int i = 0; i < WorldMapResolution; i++)
            {
                component.InlandWaterConnectivity[i] = new TileForInlandWaterConnectivity[WorldMapResolution];
                for (int j = 0; j < WorldMapResolution; j++)
                {
                    component.InlandWaterConnectivity[i][j] = InlandWaterConnectivity[i * WorldMapResolution + j];
                }
            }



            component.BorderLines = new List <Generation.World.WaterBorderLine>();
            foreach (var borderLineStorage in BorderLines)
            {
                component.BorderLines.Add(borderLineStorage);
            }
        }