示例#1
0
        public override bool Place(Point origin, StructureMap structures)
        {
            DesertDescription desertDescription = DesertDescription.CreateFromPlacement(origin);

            if (!desertDescription.IsValid)
            {
                return(false);
            }
            ExportDescriptionToEngine(desertDescription);
            SandMound.Place(desertDescription);
            desertDescription.UpdateSurfaceMap();
            if (GenBase._random.NextFloat() <= ChanceOfEntrance)
            {
                switch (GenBase._random.Next(4))
                {
                case 0:
                    ChambersEntrance.Place(desertDescription);
                    break;

                case 1:
                    AnthillEntrance.Place(desertDescription);
                    break;

                case 2:
                    LarvaHoleEntrance.Place(desertDescription);
                    break;

                case 3:
                    PitEntrance.Place(desertDescription);
                    break;
                }
            }
            DesertHive.Place(desertDescription);
            CleanupArea(desertDescription.Hive);
            Rectangle area = new Rectangle(desertDescription.CombinedArea.X, 50, desertDescription.CombinedArea.Width, desertDescription.CombinedArea.Bottom - 20);

            structures.AddStructure(area, 10);
            return(true);
        }
示例#2
0
        public override bool Place(Point origin, StructureMap structures)
        {
            DesertDescription fromPlacement = DesertDescription.CreateFromPlacement(origin);

            if (!fromPlacement.IsValid)
            {
                return(false);
            }
            DesertBiome.ExportDescriptionToEngine(fromPlacement);
            SandMound.Place(fromPlacement);
            fromPlacement.UpdateSurfaceMap();
            if ((double)GenBase._random.NextFloat() <= (double)this.ChanceOfEntrance)
            {
                switch (GenBase._random.Next(4))
                {
                case 0:
                    ChambersEntrance.Place(fromPlacement);
                    break;

                case 1:
                    AnthillEntrance.Place(fromPlacement);
                    break;

                case 2:
                    LarvaHoleEntrance.Place(fromPlacement);
                    break;

                case 3:
                    PitEntrance.Place(fromPlacement);
                    break;
                }
            }
            DesertHive.Place(fromPlacement);
            DesertBiome.CleanupArea(fromPlacement.Hive);
            Microsoft.Xna.Framework.Rectangle area = new Microsoft.Xna.Framework.Rectangle(fromPlacement.CombinedArea.X, 50, fromPlacement.CombinedArea.Width, fromPlacement.CombinedArea.Bottom - 20);
            structures.AddStructure(area, 10);
            return(true);
        }