Esempio n. 1
0
        private void LoadRoom(Vector2 position, GameData data)
        {
            //floor
            EntList.Add(new BldgFloor(position, new Vector2(houseWidth, houseHeight)));

            //solid walls
            EntList.Add(new BldgWall(position + new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), 3 * MathHelper.PiOver2));
            EntList.Add(new BldgWall(position + new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), MathHelper.PiOver2));

            //switch
            if (!data.SwitchFound)
            {
                Switch s = new Switch(position + new Vector2(halfWidth - 32, halfHeight - 32));
                EntList.Add(s);
                PickupTriggers.Add(new TriggerPickup(s.Position, new Vector2(64, 64), s));
            }

            Note n = new Note(Vector2.Zero);
            EntList.Add(n);
            ReadingTriggers.Add(new TriggerReading(n.Position, new Vector2(64, 64), Notes.HouseNote));

            //stairs
            Stairs st = new Stairs(position - (new Vector2(halfWidth - stairsHalfWidth - 80, -halfHeight + stairsHalfHeight)));
            EntList.Add(st);
            EntList.Add(new Border(st.Position - new Vector2(0, st.Size.Y / 2 + 2), new Vector2(st.Size.X, 4)));
            EntList.Add(new Border(st.Position + new Vector2(st.Size.X / 2 + 2, 1), new Vector2(4, st.Size.Y + 2)));
            AreaChangeTriggers.Add(new TriggerChangeArea(st.Position, st.Size - new Vector2(10, 10), new AreaMars()));
        }
Esempio n. 2
0
        public void GenerateHouse1(Vector2 position, GameData data)
        {
            const float doorSize = 96;
            const float doorAscent = 96;
            const float houseWidth = 512;
            const float houseHeight = 384;
            const float halfWidth = houseWidth / 2;
            const float halfHeight = houseHeight / 2;
            const float wallWidth = 16;
            const float wallHalfWidth = wallWidth / 2;

            const float doorTopHeight = doorSize + doorAscent;
            const float wallAboveDoorSize = (houseHeight - (doorAscent + doorSize));
            const float halfWallAboveDoorSize = wallAboveDoorSize / 2;

            const float stairsWidth = 96;
            const float stairsHeight = 64;

            const float stairsHalfWidth = stairsWidth / 2;
            const float stairsHalfHeight = stairsHeight / 2;

            //floor
            EntList.Add(new BldgFloor(position, new Vector2(houseWidth, houseHeight)));

            //solid walls
            EntList.Add(new BldgWall(position + new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(0, halfHeight + wallHalfWidth), new Vector2(houseWidth + 2 * wallWidth, wallWidth), 0));
            EntList.Add(new BldgWall(position - new Vector2(halfWidth + wallHalfWidth, 0), new Vector2(houseHeight, wallWidth), 3 * MathHelper.PiOver2));

            //wall w/ entrance
            EntList.Add(new BldgWall(position - new Vector2(-halfWidth - wallHalfWidth, halfHeight - (doorAscent / 2)), new Vector2(doorAscent, wallWidth), MathHelper.PiOver2));
            EntList.Add(new BldgWall(position - new Vector2(-halfWidth - wallHalfWidth, halfHeight - doorTopHeight - halfWallAboveDoorSize), new Vector2(wallAboveDoorSize, wallWidth), MathHelper.PiOver2));

            //stairs
            Stairs s = new Stairs(position - new Vector2(halfWidth - stairsHalfWidth, -halfHeight + stairsHalfHeight));
            EntList.Add(s);
            EntList.Add(new Border(s.Position - new Vector2(0, s.Size.Y / 2 + 2), new Vector2(s.Size.X, 4)));
            AreaChangeTriggers.Add(new TriggerChangeArea(s.Position, s.Size - new Vector2(10, 10), new AreaUpstairs()));
        }