Exemplo n.º 1
0
        private void PopulateSpecialRoom(Scene scene, Zone zone, Vector3 roomCenter, PopulateSchemeFlags flags, ref PopulateRoomResults results)
        {
            int rng = rand.Next(8);

            if (flags.ClearPerimeter)
            {
                if (rng == 7)
                {
                    SceneStructures.Arena(WallTexture)(scene, zone, roomCenter);
                }
            }
            if (flags.ClearFloor)
            {
                if (rng < 7 || !flags.ClearPerimeter)
                {
                    results.GenerateFloor = false;
                    SceneStructures.Pit(FloorTexture, WallTexture)(scene, zone, roomCenter);
                    SceneStructures.PitFloor(Assets.iceTexture)(scene, zone, roomCenter);

                    if (rng < 3 && flags.ClearCenter)
                    {
                        SceneStructures.PitPillar(WallTexture)(scene, zone, roomCenter);
                    }
                }
            }

            if (rand.Next(2) == 0)
            {
                SceneStructures.IceCutCorners(Assets.iceTexture)(scene, zone, roomCenter);
            }
        }
        private void PopulateSpecialRoom(Scene scene, Zone zone, Vector3 roomCenter, PopulateSchemeFlags flags, ref PopulateRoomResults results)
        {
            int rng = rand.Next(6);

            if (flags.ClearPerimeter)
            {
                if (rng == 0 || rng == 1)
                {
                    SceneStructures.Arena(WallTexture)(scene, zone, roomCenter);
                }
            }
            if (flags.ClearFloor)
            {
                if (rng == 2 || rng == 3)
                {
                    results.GenerateFloor = false;
                    SceneStructures.Pit(FloorTexture, WallTexture)(scene, zone, roomCenter);

                    if (rng == 3 && flags.ClearCenter)
                    {
                        SceneStructures.PitPillar(WallTexture)(scene, zone, roomCenter);
                    }
                }
            }
        }
        private void PopulateRoomWalls(Scene scene, Zone zone, Vector3 roomCenter, PopulateSchemeFlags flags)
        {
            int rnd = rand.Next(4);

            if (flags.NotJoint && rnd == 0)
            {
                SceneStructures.CutCorners(WallTexture)(scene, zone, roomCenter);
            }
            else if (rnd == 1)
            {
                SceneStructures.Pillars4Outer(WallTexture)(scene, zone, roomCenter);
            }
        }
Exemplo n.º 4
0
        private void PopulateRoomCenter(Scene scene, Zone zone, Vector3 roomCenter, PopulateSchemeFlags flags)
        {
            int rnd = rand.Next(3);

            if (flags.ClearCenter)
            {
                if (rnd == 0)
                {
                    SceneStructures.PillarSmall(WallTexture)(scene, zone, roomCenter);
                }
                else if (rnd == 1)
                {
                    SceneStructures.PillarBig(WallTexture)(scene, zone, roomCenter);
                }
            }
            else
            {
                if (rnd == 2)
                {
                    SceneStructures.Pillars4Inner(WallTexture)(scene, zone, roomCenter);
                }
            }
        }
Exemplo n.º 5
0
        protected override PopulateRoomResults PopulateRoom(Scene scene, Zone zone, int x, int y, PopulateSchemeFlags flags)
        {
            PopulateRoomResults results = new PopulateRoomResults
            {
                GenerateFloor = true
            };

            float   left       = x * tileSize - size * tileSize / 2;
            float   right      = left + tileSize;
            float   bottom     = y * tileSize - size * tileSize / 2;
            float   top        = bottom + tileSize;
            Vector3 roomCenter = new Vector3((left + right) / 2, 0f, (top + bottom) / 2);

            bool[] roomCorridors = Enumerable.Range(0, 4).Select(t => corridorLayout[x, y, t]).ToArray();

            if ((x != exitRoom.X || y != exitRoom.Y) && (x != size / 2 || y != size / 2))
            {
                int monsterCount = rand.Next(2, monstersPerRoom + 1);
                game.PlayerStats.totalMonsters += monsterCount;
                List <Vector3> spawnPoints = new List <Vector3>();
                Vector2        shift       = monsterCount == 1 ? Vector2.Zero : new Vector2(30f, 0f);
                float          angleOffset = (float)(rand.NextDouble() * Math.PI * 2f);
                for (int i = 0; i < monsterCount; i++)
                {
                    Vector2 position = new Vector2(roomCenter.X, roomCenter.Z);
                    position += Vector2.Transform(shift, Mathg.RotationMatrix2D(angleOffset + i * (float)Math.PI * 2f / monsterCount));
                    Vector3 position3 = new Vector3(position.X, -1f, position.Y);

                    Monster monster = Mathg.DiscreteChoiceFn(rand, new Func <Monster>[]
                    {
                        () => new BasicMonster(position3, monsterHP, monsterDamage),
                        () => new BasicMonster(position3, monsterHP, monsterDamage),
                        () => new ShotgunDude(position3, monsterHP, monsterDamage),
                        () => new SpinnyBoi(position3, monsterHP * 2, monsterDamage),
                        () => new Spooper(position3, monsterHP * 1.5f, monsterDamage)
                    }, monsterChances);

                    scene.AddGameObject(monster);
                }
            }



            if (rand.Next(7) == 0)
            {
                SceneStructures.PitWithBridges(FloorTexture, WallTexture, FloorTexture, roomCorridors).Invoke(scene, zone, roomCenter);
                SceneGenUtils.AddFloor(zone, -50f * Vector2.One, 50f * Vector2.One, -10f, Assets.lavaTexture, true, roomCenter, 75f);
                results.GenerateFloor = false;
            }
            else if (rand.Next(3) == 0)
            {
                if (x != size / 2 || y != size / 2)
                {
                    SpawnPools(scene, x, y, roomCenter, flags);
                }

                List <Generator> generators = new List <Generator>
                {
                    SceneStructures.Pillars4Inner(WallTexture),
                    SceneStructures.Pillars4Outer(WallTexture)
                };

                if (flags.ClearCenter)
                {
                    generators.Add(SceneStructures.PillarBig(WallTexture));
                    generators.Add(SceneStructures.PillarSmall(WallTexture));
                }

                Mathg.DiscreteChoice(rand, generators).Invoke(scene, zone, roomCenter);
            }

            return(results);
        }