예제 #1
0
        public override void InitializeScene()
        {
            base.InitializeScene();

            // Basic perimeter:
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            for (int i = 0; i < PerimeterX; i++)
            {
                BunkerFloor block = new BunkerFloor2(this, x0 + TileSize * i, y0);
                block.PositionY -= block.SizeY;
                block            = new BunkerFloor(this, x0 + TileSize * i, y0);
            }
            for (int i = 0; i <= PerimeterY; i++)
            {
                var block = new BunkerWall(this, x0 + TileSize * PerimeterX, y0 + TileSize * i);
                block.TileX = -1.0;
                block       = new BunkerWall(this, x0 - 0.5 * TileSize, y0 + TileSize * (PerimeterY - i));
            }
            for (int i = 0; i < PerimeterX; i++)
            {
                var block = new FloorTile(Stage, x0 + TileSize * (PerimeterX - i - 1), y0 + TileSize * PerimeterY);
            }
        }
예제 #2
0
        public override void InitializeScene()
        {
            base.InitializeScene();

            // Basic perimeter:
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;
            for (int i = 0; i < PerimeterX; i++)
            {
                BunkerFloor block = new BunkerFloor2 (this, x0 + TileSize * i, y0);
                block.PositionY -= block.SizeY;
                block = new BunkerFloor (this, x0 + TileSize * i, y0);
            }
            for (int i = 0; i <= PerimeterY; i++)
            {
                var block = new BunkerWall(this, x0 + TileSize * PerimeterX, y0 + TileSize * i);
                block.TileX = -1.0;
                block = new BunkerWall(this, x0 - 0.5 * TileSize, y0 + TileSize * (PerimeterY - i));
            }
            for (int i = 0; i < PerimeterX; i++)
            {
                var block = new FloorTile(Stage, x0 + TileSize * (PerimeterX - i - 1), y0 + TileSize * PerimeterY);
            }
        }
예제 #3
0
파일: SceneSix.cs 프로젝트: qwook/hungry
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = 102;
            PerimeterOffsetY = -100;
            PerimeterX = 30;
            PerimeterY = 10;
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, 48, 24, Texture.Get ("sprite_tile_bg2_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 24) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 4) * TileSize;
            BackgroundTiles.Parallax = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes["SceneFive"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp = x0 + TileSize * 0;
            yp = y0 + TileSize * 0;

            new FloorTile (Rear, xp + TileSize * (6 - 1), yp + TileSize * 1);
            new FloorTile (Rear, xp + TileSize * 6, yp + TileSize * 1);
            new FloorTile (Rear, xp + TileSize * 6, yp + TileSize * 2);
            new FloorTile (Rear, xp + TileSize * 6, yp + TileSize * 3);
            new FloorTile (Rear, xp + TileSize * (6 + 1), yp + TileSize * 1);
            new FloorTile (Rear, xp + TileSize * (6 + 1), yp + TileSize * 2);
            new FloorTile (Rear, xp + TileSize * (6 + 2), yp + TileSize * 1);

            //new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 1, false);
            ExtenderPlatform ep0 = new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 2, false);
            new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 3, ep0);
            //new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 4, ep0);

            var fs0 = new PressureSwitch (Front, xp + TileSize * 5, yp + TileSize * 2, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep0.OnAction (e.Self, new ActionEventArgs (bstate, ep0));
            }, 3.0);

            ExtenderPlatform ep1 = new ExtenderPlatform (Stage, xp + TileSize * (8), yp + TileSize * 3, false);
            new ExtenderPlatform (Stage, xp + TileSize * (9), yp + TileSize * 3, ep1);
            new ExtenderPlatform (Stage, xp + TileSize * (12), yp + TileSize * 3, ep1);
            new ExtenderPlatform (Stage, xp + TileSize * (13), yp + TileSize * 3, ep1);
            ExtenderPlatform ep2 = new ExtenderPlatform (Stage, xp + TileSize * (16), yp + TileSize * 4, false);
            new ExtenderPlatform (Stage, xp + TileSize * (17), yp + TileSize * 4, ep2);
            //new ExtenderPlatform (Stage, xp + TileSize * (20), yp + TileSize * 5, ep2);
            ExtenderPlatform ep3 = new ExtenderPlatform (Stage, xp + TileSize * (21), yp + TileSize * 4.5, false);
            new ExtenderPlatform (Stage, xp + TileSize * (25), yp + TileSize * 4, ep3);
            new ExtenderPlatform (Stage, xp + TileSize * (26), yp + TileSize * 4, ep3);

            var fs1 = new PressureSwitch (Front, xp + TileSize * 6, yp + TileSize * 4, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep1.OnAction (e.Self, new ActionEventArgs (bstate, ep1));
            }, 2.0);

            var fs2 = new PressureSwitch (Front, xp + TileSize * 6, yp + TileSize * 4, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep2.OnAction (e.Self, new ActionEventArgs (bstate, ep2));
            }, 3.0);

            var fs3 = new PressureSwitch (Front, xp + TileSize * 6, yp + TileSize * 4, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep3.OnAction (e.Self, new ActionEventArgs (bstate, ep3));
            }, 4.5);

            //new FloorTile (Rear, xp + TileSize * 25, yp + 6 * TileSize);
            //new FloorTile (Rear, xp + TileSize * 26, yp + 6 * TileSize);
            new FloorTile (Rear, xp + TileSize * 27, yp + 4 * TileSize);
            var ft_door = new FloorTile (Rear, xp + TileSize * 28, yp + 4 * TileSize);
            new FloorTile (Rear, xp + TileSize * 29, yp + 4 * TileSize);

            Scene next_scene = (Scene)_Game.Scenes["SceneSeven"];
            _DoorToNextScene.CornerX = ft_door.CornerX;
            _DoorToNextScene.CornerY = ft_door.CornerY + TileSize;
            _DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #4
0
파일: SceneEight.cs 프로젝트: peges/hungry
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = 126;
            PerimeterOffsetY = -92;
            PerimeterX       = 30;
            PerimeterY       = 20;
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Setup background tiles
            var BackgroundTiles = new TileMap(Background, 48, 24, Texture.Get("sprite_tile_bg2_atlas"));

            BackgroundTiles.PositionX = (PerimeterOffsetX - 24) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY + 4) * TileSize;
            BackgroundTiles.Parallax  = 1.0;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes ["SceneSeven"];

            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp = x0 + TileSize * 0;
            yp = y0 + TileSize * 0;

            var i = 0;

            for (i = 1; i < PerimeterY - 4; i++)
            {
                new ExtenderPlatform(Stage, xp + TileSize * (0), yp + TileSize * i, true);
            }

            for (i = 2; i < 17; i++)
            {
                new FloorTile(Rear, xp + TileSize * (i), yp + TileSize * (3.5));
            }

            new FloorTile(Rear, xp + TileSize * (18), yp + TileSize * (3.5));
            ExtenderPlatform ep_save = new ExtenderPlatform(Stage, xp + TileSize * (17), yp + TileSize * 1, false);

            new ExtenderPlatform(Stage, xp + TileSize * (17), yp + TileSize * 2, ep_save);
            new ExtenderPlatform(Stage, xp + TileSize * (17), yp + TileSize * 3, ep_save);

            for (i = 21; i < 24; i++)
            {
                new FloorTile(Rear, xp + TileSize * (i), yp + TileSize * (3.5));
            }

            for (i = 26; i < PerimeterX; i++)
            {
                new FloorTile(Rear, xp + TileSize * (i), yp + TileSize * (3.5));
            }

            for (i = 4; i < 15; i++)
            {
                new FloorTile(Rear, xp + TileSize * (1), yp + TileSize * (i));
            }

            new FloorTile(Rear, xp + TileSize * (1), yp + TileSize * (16));
            new FloorTile(Rear, xp + TileSize * (2), yp + TileSize * (16));
            new FloorTile(Rear, xp + TileSize * (3), yp + TileSize * (16));
            new FloorTile(Rear, xp + TileSize * (5), yp + TileSize * (16));
            new FloorTile(Rear, xp + TileSize * (6), yp + TileSize * (16));
            new FloorTile(Rear, xp + TileSize * (6), yp + TileSize * (17));
            new FloorTile(Rear, xp + TileSize * (6), yp + TileSize * (18));
            new FloorTile(Rear, xp + TileSize * (5), yp + TileSize * (15));
            new FloorTile(Rear, xp + TileSize * (5), yp + TileSize * (14));
            new FloorTile(Rear, xp + TileSize * (4), yp + TileSize * (13.5));
            new FloorTile(Rear, xp + TileSize * (3), yp + TileSize * (13.5));


            for (i = 2; i < 15; i++)
            {
                new FloorTile(Rear, xp + TileSize * (i), yp + TileSize * (11));
            }

            ExtenderPlatform ep0 = new ExtenderPlatform(Stage, xp + TileSize * (7), yp + TileSize * 12, false);

            new ExtenderPlatform(Stage, xp + TileSize * (9), yp + TileSize * 13, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (11), yp + TileSize * 14, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (13), yp + TileSize * 15, ep0);

            var fs0 = new PressureSwitch(Front, xp + TileSize * (2), yp + TileSize * (12), (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep0.OnAction(e.Self, new ActionEventArgs(bstate, ep0));
            }, 5.0);

            for (i = 11; i < 16; i++)
            {
                new FloorTile(Rear, xp + TileSize * (15), yp + TileSize * (i));
            }

            new FloorTile(Rear, xp + TileSize * (16), yp + TileSize * (15));
            new FloorTile(Rear, xp + TileSize * (17), yp + TileSize * (15));
            new FloorTile(Rear, xp + TileSize * (18), yp + TileSize * (15));

            new FloorTile(Rear, xp + TileSize * (21), yp + TileSize * (15));
            new FloorTile(Rear, xp + TileSize * (22), yp + TileSize * (15));
            new FloorTile(Rear, xp + TileSize * (23), yp + TileSize * (15));

            new FloorTile(Rear, xp + TileSize * (26), yp + TileSize * (12.5));
            new FloorTile(Rear, xp + TileSize * (27), yp + TileSize * (12.5));
            new FloorTile(Rear, xp + TileSize * (28), yp + TileSize * (12.5));
            new FloorTile(Rear, xp + TileSize * (29), yp + TileSize * (12.5));

            ExtenderPlatform ep1 = new ExtenderPlatform(Stage, xp + TileSize * (24), yp + TileSize * 14, false);

            new ExtenderPlatform(Stage, xp + TileSize * (25), yp + TileSize * 13, ep1);

            new ExtenderPlatform(Stage, xp + TileSize * (18), yp + TileSize * 8.5, ep1);
            new ExtenderPlatform(Stage, xp + TileSize * (19), yp + TileSize * 8.5, ep1);
            new ExtenderPlatform(Stage, xp + TileSize * (20), yp + TileSize * 8.5, ep1);

            var gw1 = new Gateway(Front, xp + TileSize * 16, yp + TileSize * (9.75), true);

            ProjectileSwitch ps0 = new ProjectileSwitch(Front, x0 + TileSize * 15.6, yp + TileSize * 14, (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep1.OnAction(e.Self, new ActionEventArgs(bstate, ep1));
                gw1.OnAction(e.Self, new ActionEventArgs(bstate, gw1));
            }, 8.0);

            ps0.Theta += MathHelper.Pi;

            for (i = 9; i < 18; i++)
            {
                new ExtenderPlatform(Rear, xp + TileSize * (i), yp + TileSize * (8.5), true);
            }

            var gw2 = new Gateway(Front, xp + TileSize * 18, yp + TileSize * (4.5), true);

            new FloorTile(Rear, xp + TileSize * (18), yp + TileSize * (7.5));

            for (i = 7; i < 14; i++)
            {
                for (var j = 21; j <= 23; j++)
                {
                    new FloorTile(Rear, xp + TileSize * (j), yp + TileSize * (i + 0.25));
                }
            }

            i = 5;
            ExtenderPlatform ep2 = new ExtenderPlatform(Stage, xp + TileSize * (i), yp + TileSize * 5.0, false);

            new ExtenderPlatform(Stage, xp + TileSize * (i + 3), yp + TileSize * 5.5, ep2);
            new ExtenderPlatform(Stage, xp + TileSize * (i + 6), yp + TileSize * 5.5, ep2);
            new ExtenderPlatform(Stage, xp + TileSize * (i + 9), yp + TileSize * 5.5, ep2);

            var fs1 = new PressureSwitch(Front, xp + TileSize * (3), yp + TileSize * (4.5), (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep2.OnAction(e.Self, new ActionEventArgs(bstate, ep2));
            }, 4.0);

            new FloorTile(Rear, xp + TileSize * (15), yp + TileSize * (4.5));
            new FloorTile(Rear, xp + TileSize * (15), yp + TileSize * (5.5));

            var gw3 = new Gateway(Front, xp + TileSize * 21, yp + TileSize * (4.5), true);
            var gw4 = new Gateway(Front, xp + TileSize * 23, yp + TileSize * (4.5), true);

            for (i = 7; i < 12; i++)
            {
                new FloorTile(Rear, xp + TileSize * (26), yp + TileSize * (i + 0.5));
            }

            var gw5 = new Gateway(Front, xp + TileSize * 26, yp + TileSize * (4.5), true);

            var fs2 = new PressureSwitch(Front, xp + TileSize * (16), yp + TileSize * (4.5), (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep_save.OnAction(e.Self, new ActionEventArgs(bstate, ep_save));
                gw2.OnAction(e.Self, new ActionEventArgs(bstate, gw2));
                gw3.OnAction(e.Self, new ActionEventArgs(bstate, gw3));
                gw4.OnAction(e.Self, new ActionEventArgs(bstate, gw4));
                gw5.OnAction(e.Self, new ActionEventArgs(bstate, gw5));
            }, 15.0);

            var ft_door = new FloorTile(Rear, xp + TileSize * 28, yp + 4 * TileSize);

            _DoorToNextScene.PositionX = ft_door.PositionX;
            _DoorToNextScene.CornerY   = ft_door.CornerY + ft_door.SizeY;
            _DoorToNextScene.NextScene = (Scene)_Game.Scenes["SceneWin"];

            // DEBUGGING:
            //_DoorToPreviousScene.Corner = _DoorToNextScene.Corner;
            //_DoorToPreviousScene.CornerX -= _DoorToPreviousScene.SizeX;

//            _DoorToNextScene.Action += (sender, e) => {
//                Program.MainGame.AddUpdateEventHandler(this, (sender1, e1) =>
//                {
//                    lock(Program.MainUpdateLock)
//                    {
//                        Scene.InstantiateScenes(ref Program.MainGame, typeof(ISceneGameplay), typeof(SceneFirstMenu));
//                    }
//                    return true;
//                });
//            };

            // Call the base class initializer
            base.InitializeScene();
        }
예제 #5
0
        protected override void InitializeScene()
        {
            // Basic perimeter:
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            double recess_switch = -4.0;
            int chute_right = 3;

            Gateway gw_chute = null, gw_lower1 = null;
            PressureSwitch fs_chute, bs_lower1 = null, bs_lower2 = null;

            for (int i = 0; i < PerimeterX; i++) {
                if (i == PerimeterX - chute_right) {
                    double x = x0 + TileSize * i;

                    fs_chute = new PressureSwitch (Front, x - 2.0 * TileSize, y0 + TileSize + recess_switch, (sender, e) => {
                        bool bstate = (SwitchState)e.Info != SwitchState.Open;
                        gw_chute.OnAction (e.Self, new ActionEventArgs (bstate, gw_chute)); }, 2.0);

                    gw_chute = new SmallGateway (Front, x, y0 + TileSize, false);
                    gw_chute.CenterShift ();
                    gw_chute.PositionX += 0.5 * TileSize;
                    gw_chute.PositionY -= 0.5 * (TileSize - 0.5 * gw_chute.SizeY);
                    gw_chute.Theta = -0.5 * Math.PI;

                    continue;
                }
                BunkerFloor block = new BunkerFloor2 (this, x0 + TileSize * i, y0);
                block.PositionY -= block.SizeY;
                block = new BunkerFloor (this, x0 + TileSize * i, y0);
            }
            for (int i = 0; i <= PerimeterY; i++) {
                var block = new BunkerWall (this, x0 + TileSize * PerimeterX, y0 + TileSize * i);
                block.TileX = -1.0;
                block = new BunkerWall (this, x0 - 0.5 * TileSize, y0 + TileSize * (PerimeterY - i));

            }
            for (int i = 0; i < PerimeterX; i++) {
                var block = new FloorTile (Stage, x0 + TileSize * (PerimeterX - i - 1), y0 + TileSize * PerimeterY);
            }

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, Perimeter2X, 6, Texture.Get ("sprite_dark_rubble_atlas"));
            BackgroundTiles.CornerX = x0 - 2 * TileSize;
            BackgroundTiles.CornerY = y0;
            BackgroundTiles.PositionZ = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();
            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            yp += TileSize;
            xp += (PerimeterX / 2) * TileSize;

            // Set up doors:
            Scene prev_scene = (Scene)Program.MainGame.Scenes ["SceneTwo"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;
            //			Scene next_scene = (Scene)Scene.Scenes["SceneThree"];
            //			_DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
            //			_DoorToNextScene.Destination.Position = _DoorToNextScene.Position;

            var pipe_texture = Texture.Get ("sprite_bg_pipes");
            for (int i = 0; i < 5; i++) {
                var bg_pipes =
                    new SpriteBase (Background,
                                   x0 + pipe_texture.Width * i - TileSize,
                                   y0 - pipe_texture.Height + TileSize - 6, pipe_texture);
                bg_pipes.PositionZ = 0.5;
            }

            double y1 = y0 - (Perimeter2Y + 1) * TileSize;

            for (int i = 0; i < Perimeter2X; i++) {
                BunkerFloor block = new BunkerFloor2 (this, x0 + TileSize * i, y1);
                block.PositionY -= block.SizeY;
                if (i > PerimeterX) {
                    var roof = new BunkerWall (this, x0 + TileSize * i, y1 + TileSize * (Perimeter2Y + 1));
                    roof.Theta = -MathHelper.PiOver2;
                }
                if (i > 53 && i < 60)
                    continue;
                block = new BunkerFloor (this, x0 + TileSize * i, y1);

            }
            for (int i = 0; i <= Perimeter2Y; i++) {
                var block = new BunkerWall (this, x0 + TileSize * Perimeter2X, y1 + TileSize * i);
                block.TileX = -1.0;
                block = new BunkerWall (this, x0 - 0.5 * TileSize, y1 + TileSize * (Perimeter2Y - i));
            }

            // Lower area stuff
            for (int i = 0; i < 8; i++) {
                new BunkerFloor (this, x0 + TileSize * i, y1 + TileSize);
            }
            for (int i = 2; i < 6; i++) {
                new BunkerFloor (this, x0 + TileSize * i, y1 + 2 * TileSize);
            }
            for (int i = 20; i < 38; i++) {
                new BunkerFloor (this, x0 + TileSize * i, y1 + TileSize);
            }
            for (int i = 22; i < 34; i++) {
                new BunkerFloor (this, x0 + TileSize * i, y1 + 2 * TileSize);
            }
            new BunkerFloor (this, x0 + TileSize * 31, y1 + 3.5 * TileSize);
            for (int i = 28; i < 32; i++) {
                new BunkerFloor (this, x0 + TileSize * i, y1 + 3 * TileSize);
            }
            for (int i = 42; i < 50; i++) {
                int j;
                for (j = Perimeter2Y; j > 4; j--)
                    new BunkerFloor (this, x0 + TileSize * i, y1 + (j + 0.5) * TileSize);
                var block = new BunkerFloor2 (this, x0 + TileSize * i, y1 + (j + 1.5) * TileSize);
                block.PositionY -= block.SizeY;
            }
            {
                int j;
                for (j = Perimeter2Y; j > 3; j--)
                    new BunkerFloor (this, x0 + TileSize * 55, y1 + (j + 0.5) * TileSize);
                var block = new BunkerFloor2 (this, x0 + TileSize * 55, y1 + (j + 1.5) * TileSize);
                block.PositionY -= block.SizeY;
                gw_lower1 = new SmallGateway (Front, x0 + TileSize * 55.5, y1, false);
                bs_lower1 = new ProjectileSwitch (Front, x0 + TileSize * 55, y1 + (j + 0.5) * TileSize, (sender, e) =>
                {
                    bool bstate = (SwitchState)e.Info != SwitchState.Open;
                    bool bstate_bs_lower_2 = bs_lower2.State != SwitchState.Open;
                    gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_2, gw_lower1));
                }, 5.0);

                var ep1 = new ExtenderPlatform (Rear, x0 + TileSize * 57, y1 + 0.5 * TileSize, false);
                new ExtenderPlatform (Rear, x0 + TileSize * 58, y1 + 2.0 * TileSize, ep1);
                new ExtenderPlatform (Rear, x0 + TileSize * 60, y1 + 3.5 * TileSize, ep1);
                new ExtenderPlatform (Rear, x0 + TileSize * 62, y1 + 2.5 * TileSize, ep1);
                new ExtenderPlatform (Rear, x0 + TileSize * 63, y1 + 1.5 * TileSize, ep1);
                new ExtenderPlatform (Rear, x0 + TileSize * 65, y1 + 1.5 * TileSize, ep1);

                bs_lower2 = new ProjectileSwitch (Front, x0 + TileSize * 56, y1 + (j - 0.5) * TileSize, (sender, e) =>
                {
                    bool bstate = (SwitchState)e.Info != SwitchState.Open;
                    ep1.OnAction (e.Self, new ActionEventArgs (bstate, ep1));
                    bool bstate_bs_lower_1 = bs_lower1.State != SwitchState.Open;
                    gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_1, gw_lower1));
                }, 5.0);
                bs_lower1.CenterShift ();
                bs_lower2.CenterShift ();
                bs_lower2.Theta = MathHelper.Pi;
            }

            for (int j = 1; j < 5; j++) {
                if(j == 2)
                    continue;
                new BunkerFloor (this, x0 + TileSize * 61, y1 + j * TileSize);
            }
            new BunkerFloor (this, x0 + TileSize * 62, y1 + 1 * TileSize);

            yp = y1 + 2.5 * TileSize;

            //new BunkerFloor (this, x0 + TileSize * 65, y1 + 1 * TileSize);
            //new BunkerFloor (this, x0 + TileSize * 66, y1 + 1 * TileSize);
            new BunkerFloor (this, x0 + TileSize * 66, yp);
            //new BunkerFloor (this, x0 + TileSize * 67, y1 + 1 * TileSize);
            new BunkerFloor (this, x0 + TileSize * 67, yp);
            new BunkerFloor (this, x0 + TileSize * 67, yp + TileSize);

            yp += 0.5 * TileSize;

            ExtenderPlatform ep_walkway1_first = new ExtenderPlatform (Rear, x0 + TileSize * 67, yp, false);
            ExtenderPlatform ep_walkway1_last = null;
            for(int i = 1; i < 6; i++)
                ep_walkway1_last = new ExtenderPlatform (Rear, ep_walkway1_first.CornerX + TileSize * i, ep_walkway1_first.CornerY, ep_walkway1_first);

            new BunkerFloor (this, ep_walkway1_last.CornerX + TileSize, y1 + 1 * TileSize);
            new BunkerFloor (this, ep_walkway1_last.CornerX + TileSize, y1 + 2 * TileSize);
            new BunkerFloor (this, ep_walkway1_last.CornerX + TileSize, y1 + 3 * TileSize);

            new BunkerFloor (this, ep_walkway1_last.CornerX + 2 * TileSize, y1 + 1 * TileSize);
            new BunkerFloor (this, ep_walkway1_last.CornerX + 2 * TileSize, y1 + 2 * TileSize);

            new BunkerFloor (this, ep_walkway1_last.CornerX + 3 * TileSize, y1 + 1 * TileSize);

            var bs_lower3 = new ProjectileSwitch (Front, ep_walkway1_last.CornerX, y1 + 1.0 * TileSize, (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep_walkway1_first.OnAction (e.Self, new ActionEventArgs (bstate, ep_walkway1_first));
            }, 2.0);
            bs_lower3.CenterShift ();
            bs_lower3.Theta = -MathHelper.PiOver2;

            Scene next_scene = (Scene)Program.MainGame.Scenes["SceneFour"];
            _DoorToNextScene = new Door(Rear, x0 + TileSize * 76, y1 + TileSize, next_scene.DoorToPreviousScene);
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;

            // Call the base class initializer
            base.InitializeScene();
        }
예제 #6
0
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = -2;
            PerimeterOffsetY = 0;
            PerimeterX       = 32;
            PerimeterY       = 12;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp += TileSize * PerimeterX * 0.5;
            yp += TileSize;

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes["SceneOne"];

            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Setup background tiles
            var BackgroundTiles = new TileMap(Background, 48, 24, Texture.Get("sprite_tile_bg2_atlas"));

            BackgroundTiles.PositionX = (PerimeterOffsetX - 9) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 4) * TileSize;
            BackgroundTiles.Parallax  = 1.0;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();

            // Control key indicators (info graphics)
            var infogfx_texture = Texture.Get("sprite_infogfx_cabinet_buttons");
            var f_infogfx       = new SpriteBase(Rear, xp - 2 * TileSize, yp, infogfx_texture).SetRegion("use_equipped_item");

            // Get cross-scene variables
            Scene previous_scene = (Scene)_Game.Scenes["SceneOne"];

            double recess_switch = -4.0;
            double recess_gw     = -2.0;

            for (int i = 0; i < 5; i++)
            {
                var spidey = new Spidey(Stage, xp - (5 + 0.25 * i) * TileSize, yp);
            }

            // Gateways
            var gw1 = new Gateway(Front, xp - TileSize * 3, yp + recess_gw, false);
            var gw2 = new Gateway(Front, xp + TileSize * 3, yp + recess_gw, false);

            // Walls above gateways
            for (int i = 2; i < PerimeterY - 1; i++)
            {
                new FloorTile(Rear, gw1.CornerX, gw1.CornerY + (i) * TileSize + 8);
                new FloorTile(Rear, gw2.CornerX, gw2.CornerY + (i) * TileSize + 8);
            }

            var fs10 = new PressureSwitch(Front, gw1.CornerX + TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction(e.Self, new ActionEventArgs(bstate, gw1));
            });
            var fs11 = new PressureSwitch(Front, gw1.CornerX - TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction(e.Self, new ActionEventArgs(bstate, gw1));
            }, fs10);

            var fs20 = new PressureSwitch(Front, gw2.CornerX - TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction(e.Self, new ActionEventArgs(bstate, gw2));
            });
            var fs21 = new PressureSwitch(Front, gw2.CornerX + TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction(e.Self, new ActionEventArgs(bstate, gw2));
            }, fs20);

            xp = fs21.CornerX + 2 * TileSize;

            var ft_room_r = new FloorTile(Stage, xp, yp);

            for (int i = 1; i < 8; i++)
            {
                new FloorTile(Stage, xp + i * TileSize, yp);
            }

            yp += TileSize;
            xp += TileSize;

            for (int i = 0; i < 4; i++)
            {
                new FloorTile(Stage, xp + (i + 1) * TileSize, yp);
            }
            //yp += 2 * TileSize;
            xp += 4 * TileSize;

            ExtenderPlatform last_platform_0 = null;
            ExtenderPlatform last_platform_1 = null;

            for (int i = 0; i < 3; i++)
            {
                last_platform_0 = new ExtenderPlatform(Stage, xp += TileSize, yp += TileSize, last_platform_0);
            }
            xp -= 2 * TileSize;
            yp += TileSize;
            for (int i = 0; i < 6; i++)
            {
                last_platform_1 = new ExtenderPlatform(Stage, xp -= TileSize, yp, true);
            }

            // Set up next door:
            Scene next_scene = (Scene)_Game.Scenes["SceneThree"];

            _DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
            _DoorToNextScene.PositionX   = last_platform_1.PositionX;
            _DoorToNextScene.CornerY     = yp += last_platform_1.SizeY;

            // Update next scene's door position relative to its -initial- position (set with constructor/instantiation)
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;


            var fs30 = new PressureSwitch(Front, ft_room_r.CornerX + TileSize, ft_room_r.CornerY + TileSize + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_0.OnAction(e.Self, new ActionEventArgs(bstate, last_platform_0));
            }, 5.0);

            // Call the base class initializer
            base.InitializeScene();
        }
예제 #7
0
        public override void InitializeScene()
        {
            // Basic perimeter:
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            double recess_switch = -4.0;
            int    chute_right   = 3;

            Gateway        gw_chute = null, gw_lower1 = null;
            PressureSwitch fs_chute, bs_lower1 = null, bs_lower2 = null;

            for (int i = 0; i < PerimeterX; i++)
            {
                if (i == PerimeterX - chute_right)
                {
                    double x = x0 + TileSize * i;

                    fs_chute = new PressureSwitch(Front, x - 2.0 * TileSize, y0 + TileSize + recess_switch, (sender, e) => {
                        bool bstate = (SwitchState)e.Info != SwitchState.Open;
                        gw_chute.OnAction(e.Self, new ActionEventArgs(bstate, gw_chute));
                    }, 2.0);

                    gw_chute = new SmallGateway(Front, x, y0 + TileSize, false);
                    gw_chute.CenterShift();
                    gw_chute.PositionX += 0.5 * TileSize;
                    gw_chute.PositionY -= 0.5 * (TileSize - 0.5 * gw_chute.SizeY);
                    gw_chute.Theta      = -0.5 * Math.PI;

                    continue;
                }
                BunkerFloor block = new BunkerFloor2(this, x0 + TileSize * i, y0);
                block.PositionY -= block.SizeY;
                block            = new BunkerFloor(this, x0 + TileSize * i, y0);
            }
            for (int i = 0; i <= PerimeterY; i++)
            {
                var block = new BunkerWall(this, x0 + TileSize * PerimeterX, y0 + TileSize * i);
                block.TileX = -1.0;
                block       = new BunkerWall(this, x0 - 0.5 * TileSize, y0 + TileSize * (PerimeterY - i));
            }
            for (int i = 0; i < PerimeterX; i++)
            {
                var block = new FloorTile(Stage, x0 + TileSize * (PerimeterX - i - 1), y0 + TileSize * PerimeterY);
            }

            // Setup background tiles
            var BackgroundTiles = new TileMap(Background, Perimeter2X, 6, Texture.Get("sprite_dark_rubble_atlas"));

            BackgroundTiles.CornerX  = x0 - 2 * TileSize;
            BackgroundTiles.CornerY  = y0;
            BackgroundTiles.Parallax = 1.0;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();
            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            yp += TileSize;
            xp += (PerimeterX / 2) * TileSize;

            // Set up doors:
            Scene prev_scene = (Scene)_Game.Scenes ["SceneTwo"];

            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;
//			Scene next_scene = (Scene)Scene.Scenes["SceneThree"];
//			_DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
//			_DoorToNextScene.Destination.Position = _DoorToNextScene.Position;

            var pipe_texture = Texture.Get("sprite_bg_pipes");

            for (int i = 0; i < 5; i++)
            {
                var bg_pipes =
                    new SpriteBase(Background,
                                   x0 + pipe_texture.Width * i - TileSize,
                                   y0 - pipe_texture.Height + TileSize - 6, pipe_texture);
                bg_pipes.Parallax = 0.5;
            }

            double y1 = y0 - (Perimeter2Y + 1) * TileSize;

            for (int i = 0; i < Perimeter2X; i++)
            {
                BunkerFloor block = new BunkerFloor2(this, x0 + TileSize * i, y1);
                block.PositionY -= block.SizeY;
                if (i > PerimeterX)
                {
                    var roof = new BunkerWall(this, x0 + TileSize * i, y1 + TileSize * (Perimeter2Y + 1));
                    roof.Theta = -MathHelper.PiOver2;
                }
                if (i > 53 && i < 60)
                {
                    continue;
                }
                block = new BunkerFloor(this, x0 + TileSize * i, y1);
            }
            for (int i = 0; i <= Perimeter2Y; i++)
            {
                var block = new BunkerWall(this, x0 + TileSize * Perimeter2X, y1 + TileSize * i);
                block.TileX = -1.0;
                block       = new BunkerWall(this, x0 - 0.5 * TileSize, y1 + TileSize * (Perimeter2Y - i));
            }


            // Lower area stuff
            for (int i = 0; i < 8; i++)
            {
                new BunkerFloor(this, x0 + TileSize * i, y1 + TileSize);
            }
            for (int i = 2; i < 6; i++)
            {
                new BunkerFloor(this, x0 + TileSize * i, y1 + 2 * TileSize);
            }
            for (int i = 20; i < 38; i++)
            {
                new BunkerFloor(this, x0 + TileSize * i, y1 + TileSize);
            }
            for (int i = 22; i < 34; i++)
            {
                new BunkerFloor(this, x0 + TileSize * i, y1 + 2 * TileSize);
            }
            new BunkerFloor(this, x0 + TileSize * 31, y1 + 3.5 * TileSize);
            for (int i = 28; i < 32; i++)
            {
                new BunkerFloor(this, x0 + TileSize * i, y1 + 3 * TileSize);
            }
            for (int i = 42; i < 50; i++)
            {
                int j;
                for (j = Perimeter2Y; j > 4; j--)
                {
                    new BunkerFloor(this, x0 + TileSize * i, y1 + (j + 0.5) * TileSize);
                }
                var block = new BunkerFloor2(this, x0 + TileSize * i, y1 + (j + 1.5) * TileSize);
                block.PositionY -= block.SizeY;
            }
            {
                int j;
                for (j = Perimeter2Y; j > 3; j--)
                {
                    new BunkerFloor(this, x0 + TileSize * 55, y1 + (j + 0.5) * TileSize);
                }
                var block = new BunkerFloor2(this, x0 + TileSize * 55, y1 + (j + 1.5) * TileSize);
                block.PositionY -= block.SizeY;
                gw_lower1        = new SmallGateway(Front, x0 + TileSize * 55.5, y1, false);
                bs_lower1        = new ProjectileSwitch(Front, x0 + TileSize * 55, y1 + (j + 0.5) * TileSize, (sender, e) =>
                {
                    bool bstate            = (SwitchState)e.Info != SwitchState.Open;
                    bool bstate_bs_lower_2 = bs_lower2.State != SwitchState.Open;
                    gw_lower1.OnAction(e.Self, new ActionEventArgs(bstate || bstate_bs_lower_2, gw_lower1));
                }, 5.0);
                var ep1 = new ExtenderPlatform(Rear, x0 + TileSize * 57, y1 + 0.5 * TileSize, false);
                new ExtenderPlatform(Rear, x0 + TileSize * 58, y1 + 2.0 * TileSize, ep1);
                new ExtenderPlatform(Rear, x0 + TileSize * 60, y1 + 3.5 * TileSize, ep1);
                new ExtenderPlatform(Rear, x0 + TileSize * 62, y1 + 2.5 * TileSize, ep1);
                new ExtenderPlatform(Rear, x0 + TileSize * 63, y1 + 1.5 * TileSize, ep1);
                new ExtenderPlatform(Rear, x0 + TileSize * 65, y1 + 1.5 * TileSize, ep1);

                bs_lower2 = new ProjectileSwitch(Front, x0 + TileSize * 56, y1 + (j - 0.5) * TileSize, (sender, e) =>
                {
                    bool bstate = (SwitchState)e.Info != SwitchState.Open;
                    ep1.OnAction(e.Self, new ActionEventArgs(bstate, ep1));
                    bool bstate_bs_lower_1 = bs_lower1.State != SwitchState.Open;
                    gw_lower1.OnAction(e.Self, new ActionEventArgs(bstate || bstate_bs_lower_1, gw_lower1));
                }, 5.0);
                bs_lower1.CenterShift();
                bs_lower2.CenterShift();
                bs_lower2.Theta = MathHelper.Pi;
            }
            for (int j = 1; j < 5; j++)
            {
                if (j == 2)
                {
                    continue;
                }
                new BunkerFloor(this, x0 + TileSize * 61, y1 + j * TileSize);
            }
            new BunkerFloor(this, x0 + TileSize * 62, y1 + 1 * TileSize);

            yp = y1 + 2.5 * TileSize;

            //new BunkerFloor (this, x0 + TileSize * 65, y1 + 1 * TileSize);
            //new BunkerFloor (this, x0 + TileSize * 66, y1 + 1 * TileSize);
            new BunkerFloor(this, x0 + TileSize * 66, yp);
            //new BunkerFloor (this, x0 + TileSize * 67, y1 + 1 * TileSize);
            new BunkerFloor(this, x0 + TileSize * 67, yp);
            new BunkerFloor(this, x0 + TileSize * 67, yp + TileSize);

            yp += 0.5 * TileSize;

            ExtenderPlatform ep_walkway1_first = new ExtenderPlatform(Rear, x0 + TileSize * 67, yp, false);
            ExtenderPlatform ep_walkway1_last  = null;

            for (int i = 1; i < 6; i++)
            {
                ep_walkway1_last = new ExtenderPlatform(Rear, ep_walkway1_first.CornerX + TileSize * i, ep_walkway1_first.CornerY, ep_walkway1_first);
            }

            new BunkerFloor(this, ep_walkway1_last.CornerX + TileSize, y1 + 1 * TileSize);
            new BunkerFloor(this, ep_walkway1_last.CornerX + TileSize, y1 + 2 * TileSize);
            new BunkerFloor(this, ep_walkway1_last.CornerX + TileSize, y1 + 3 * TileSize);

            new BunkerFloor(this, ep_walkway1_last.CornerX + 2 * TileSize, y1 + 1 * TileSize);
            new BunkerFloor(this, ep_walkway1_last.CornerX + 2 * TileSize, y1 + 2 * TileSize);

            new BunkerFloor(this, ep_walkway1_last.CornerX + 3 * TileSize, y1 + 1 * TileSize);


            var bs_lower3 = new ProjectileSwitch(Front, ep_walkway1_last.CornerX, y1 + 1.0 * TileSize, (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep_walkway1_first.OnAction(e.Self, new ActionEventArgs(bstate, ep_walkway1_first));
            }, 2.0);

            bs_lower3.CenterShift();
            bs_lower3.Theta = -MathHelper.PiOver2;

            Scene next_scene = (Scene)_Game.Scenes["SceneFour"];

            _DoorToNextScene = new Door(Rear, x0 + TileSize * 76, y1 + TileSize, next_scene.DoorToPreviousScene);
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;

            // Call the base class initializer
            base.InitializeScene();
        }
예제 #8
0
파일: SceneEight.cs 프로젝트: qwook/hungry
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = 126;
            PerimeterOffsetY = -92;
            PerimeterX = 30;
            PerimeterY = 20;
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, 48, 24, Texture.Get ("sprite_tile_bg2_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 24) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY + 4) * TileSize;
            BackgroundTiles.Parallax = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes ["SceneSeven"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp = x0 + TileSize * 0;
            yp = y0 + TileSize * 0;

            var i = 0;
            for (i = 1; i < PerimeterY - 4; i++) {
                new ExtenderPlatform (Stage, xp + TileSize * (0), yp + TileSize * i, true);
            }

            for (i = 2; i < 17; i++) {
                new FloorTile (Rear, xp + TileSize * (i), yp + TileSize * (3.5));
            }

            new FloorTile (Rear, xp + TileSize * (18), yp + TileSize * (3.5));
            ExtenderPlatform ep_save = new ExtenderPlatform (Stage, xp + TileSize * (17), yp + TileSize * 1, false);
            new ExtenderPlatform (Stage, xp + TileSize * (17), yp + TileSize * 2, ep_save);
            new ExtenderPlatform (Stage, xp + TileSize * (17), yp + TileSize * 3, ep_save);

            for (i = 21; i < 24; i++) {
                new FloorTile (Rear, xp + TileSize * (i), yp + TileSize * (3.5));
            }

            for (i = 26; i < PerimeterX; i++) {
                new FloorTile (Rear, xp + TileSize * (i), yp + TileSize * (3.5));
            }

            for (i = 4; i < 15; i++) {
                new FloorTile (Rear, xp + TileSize * (1), yp + TileSize * (i));
            }

            new FloorTile (Rear, xp + TileSize * (1), yp + TileSize * (16));
            new FloorTile (Rear, xp + TileSize * (2), yp + TileSize * (16));
            new FloorTile (Rear, xp + TileSize * (3), yp + TileSize * (16));
            new FloorTile (Rear, xp + TileSize * (5), yp + TileSize * (16));
            new FloorTile (Rear, xp + TileSize * (6), yp + TileSize * (16));
            new FloorTile (Rear, xp + TileSize * (6), yp + TileSize * (17));
            new FloorTile (Rear, xp + TileSize * (6), yp + TileSize * (18));
            new FloorTile (Rear, xp + TileSize * (5), yp + TileSize * (15));
            new FloorTile (Rear, xp + TileSize * (5), yp + TileSize * (14));
            new FloorTile (Rear, xp + TileSize * (4), yp + TileSize * (13.5));
            new FloorTile (Rear, xp + TileSize * (3), yp + TileSize * (13.5));

            for (i = 2; i < 15; i++) {
                new FloorTile (Rear, xp + TileSize * (i), yp + TileSize * (11));
            }

            ExtenderPlatform ep0 = new ExtenderPlatform (Stage, xp + TileSize * (7), yp + TileSize * 12, false);
            new ExtenderPlatform (Stage, xp + TileSize * (9), yp + TileSize * 13, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (11), yp + TileSize * 14, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (13), yp + TileSize * 15, ep0);

            var fs0 = new PressureSwitch (Front, xp + TileSize * (2), yp + TileSize * (12), (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep0.OnAction (e.Self, new ActionEventArgs (bstate, ep0));
            }, 5.0);

            for (i = 11; i < 16; i++) {
                new FloorTile (Rear, xp + TileSize * (15), yp + TileSize * (i));
            }

            new FloorTile (Rear, xp + TileSize * (16), yp + TileSize * (15));
            new FloorTile (Rear, xp + TileSize * (17), yp + TileSize * (15));
            new FloorTile (Rear, xp + TileSize * (18), yp + TileSize * (15));

            new FloorTile (Rear, xp + TileSize * (21), yp + TileSize * (15));
            new FloorTile (Rear, xp + TileSize * (22), yp + TileSize * (15));
            new FloorTile (Rear, xp + TileSize * (23), yp + TileSize * (15));

            new FloorTile (Rear, xp + TileSize * (26), yp + TileSize * (12.5));
            new FloorTile (Rear, xp + TileSize * (27), yp + TileSize * (12.5));
            new FloorTile (Rear, xp + TileSize * (28), yp + TileSize * (12.5));
            new FloorTile (Rear, xp + TileSize * (29), yp + TileSize * (12.5));

            ExtenderPlatform ep1 = new ExtenderPlatform (Stage, xp + TileSize * (24), yp + TileSize * 14, false);
            new ExtenderPlatform (Stage, xp + TileSize * (25), yp + TileSize * 13, ep1);

            new ExtenderPlatform (Stage, xp + TileSize * (18), yp + TileSize * 8.5, ep1);
            new ExtenderPlatform (Stage, xp + TileSize * (19), yp + TileSize * 8.5, ep1);
            new ExtenderPlatform (Stage, xp + TileSize * (20), yp + TileSize * 8.5, ep1);

            var gw1 = new Gateway (Front, xp + TileSize * 16, yp + TileSize * (9.75), true);

            ProjectileSwitch ps0 = new ProjectileSwitch (Front, x0 + TileSize * 15.6, yp + TileSize * 14, (sender, e) =>
                                                         {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep1.OnAction (e.Self, new ActionEventArgs (bstate, ep1));
                gw1.OnAction (e.Self, new ActionEventArgs (bstate, gw1));
            }, 8.0);
            ps0.Theta += MathHelper.Pi;

            for (i = 9; i < 18; i++) {
                new ExtenderPlatform (Rear, xp + TileSize * (i), yp + TileSize * (8.5), true);
            }

            var gw2 = new Gateway (Front, xp + TileSize * 18, yp + TileSize * (4.5), true);
            new FloorTile (Rear, xp + TileSize * (18), yp + TileSize * (7.5));

            for (i = 7; i < 14; i++) {
                for (var j = 21; j <= 23; j++) {
                    new FloorTile (Rear, xp + TileSize * (j), yp + TileSize * (i + 0.25));
                }
            }

            i = 5;
            ExtenderPlatform ep2 = new ExtenderPlatform (Stage, xp + TileSize * (i), yp + TileSize * 5.0, false);
            new ExtenderPlatform (Stage, xp + TileSize * (i + 3), yp + TileSize * 5.5, ep2);
            new ExtenderPlatform (Stage, xp + TileSize * (i + 6), yp + TileSize * 5.5, ep2);
            new ExtenderPlatform (Stage, xp + TileSize * (i + 9), yp + TileSize * 5.5, ep2);

            var fs1 = new PressureSwitch (Front, xp + TileSize * (3), yp + TileSize * (4.5), (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep2.OnAction (e.Self, new ActionEventArgs (bstate, ep2));
            }, 4.0);

            new FloorTile (Rear, xp + TileSize * (15), yp + TileSize * (4.5));
            new FloorTile (Rear, xp + TileSize * (15), yp + TileSize * (5.5));

            var gw3 = new Gateway (Front, xp + TileSize * 21, yp + TileSize * (4.5), true);
            var gw4 = new Gateway (Front, xp + TileSize * 23, yp + TileSize * (4.5), true);

            for (i = 7; i < 12; i++) {
                new FloorTile (Rear, xp + TileSize * (26), yp + TileSize * (i + 0.5));
            }

            var gw5 = new Gateway (Front, xp + TileSize * 26, yp + TileSize * (4.5), true);

            var fs2 = new PressureSwitch (Front, xp + TileSize * (16), yp + TileSize * (4.5), (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep_save.OnAction (e.Self, new ActionEventArgs (bstate, ep_save));
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
                gw3.OnAction (e.Self, new ActionEventArgs (bstate, gw3));
                gw4.OnAction (e.Self, new ActionEventArgs (bstate, gw4));
                gw5.OnAction (e.Self, new ActionEventArgs (bstate, gw5));
            }, 15.0);

            var ft_door = new FloorTile (Rear, xp + TileSize * 28, yp + 4 * TileSize);
            _DoorToNextScene.PositionX = ft_door.PositionX;
            _DoorToNextScene.CornerY = ft_door.CornerY + ft_door.SizeY;
            _DoorToNextScene.NextScene = (Scene)_Game.Scenes["SceneWin"];

            // DEBUGGING:
            //_DoorToPreviousScene.Corner = _DoorToNextScene.Corner;
            //_DoorToPreviousScene.CornerX -= _DoorToPreviousScene.SizeX;

            //            _DoorToNextScene.Action += (sender, e) => {
            //                Program.MainGame.AddUpdateEventHandler(this, (sender1, e1) =>
            //                {
            //                    lock(Program.MainUpdateLock)
            //                    {
            //                        Scene.InstantiateScenes(ref Program.MainGame, typeof(ISceneGameplay), typeof(SceneFirstMenu));
            //                    }
            //                    return true;
            //                });
            //            };

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #9
0
파일: SceneSeven.cs 프로젝트: qwook/hungry
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = 125;
            PerimeterOffsetY = -96;
            PerimeterX = 7;
            PerimeterY = 30;
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, 48, 24, Texture.Get ("sprite_tile_bg2_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 24) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY + 10) * TileSize;
            BackgroundTiles.Parallax = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes["SceneSix"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp = x0 + TileSize * 0;
            yp = y0 + TileSize * 0;

            ExtenderPlatform ep0 = new ExtenderPlatform (Stage, xp + TileSize * (0), yp + TileSize * 1, false);
            new ExtenderPlatform (Stage, xp + TileSize * (1), yp + TileSize * 1, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (3), yp + TileSize * 2, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 3, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (6), yp + TileSize * 3, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (3), yp + TileSize * 4, ep0);

            new ExtenderPlatform (Stage, xp + TileSize * (0), yp + TileSize * 3, true);
            new ExtenderPlatform (Stage, xp + TileSize * (1), yp + TileSize * 3, true);

            new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 5, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (6), yp + TileSize * 5, ep0);
            new ExtenderPlatform (Stage, xp + TileSize * (3), yp + TileSize * 6, ep0);

            new FloorTile (Rear, xp + TileSize * (0), yp + TileSize * 7);
            new FloorTile (Rear, xp + TileSize * (0), yp + TileSize * 8);
            new FloorTile (Rear, xp + TileSize * (0), yp + TileSize * 9);
            new FloorTile (Rear, xp + TileSize * (0), yp + TileSize * 10);
            new FloorTile (Rear, xp + TileSize * (0), yp + TileSize * 11);
            new FloorTile (Rear, xp + TileSize * (1), yp + TileSize * 7);

            new ExtenderPlatform (Stage, xp + TileSize * (1), yp + TileSize * 8, true);
            new ExtenderPlatform (Stage, xp + TileSize * (1), yp + TileSize * 9, true);

            new FloorTile (Rear, xp + TileSize * (2), yp + TileSize * 10);
            new FloorTile (Rear, xp + TileSize * (3), yp + TileSize * 10);
            new FloorTile (Rear, xp + TileSize * (4), yp + TileSize * 10);
            new FloorTile (Rear, xp + TileSize * (5), yp + TileSize * 10);
            new FloorTile (Rear, xp + TileSize * (6), yp + TileSize * 10);

            var ps0 = new ProjectileSwitch (Front, xp + TileSize * (6.25), yp + TileSize * (1.25) , (sender, e) =>
                                                  {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep0.OnAction (e.Self, new ActionEventArgs (bstate, ep0));
            }, 2.5);

            ExtenderPlatform ep1 = new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 11, false);
            new ExtenderPlatform (Stage, xp + TileSize * (6), yp + TileSize * 11, ep1);

            var ps1 = new ProjectileSwitch (Front, xp + TileSize * (0.7), yp + TileSize * (11.5) , (sender, e) =>
                                            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep1.OnAction (e.Self, new ActionEventArgs (bstate, ep1));
            }, 1.0);

            ExtenderPlatform ep2 = new ExtenderPlatform (Stage, xp + TileSize * (3), yp + TileSize * 12, false);
            new ExtenderPlatform (Stage, xp + TileSize * (0), yp + TileSize * 13, ep2);
            new ExtenderPlatform (Stage, xp + TileSize * (1), yp + TileSize * 13, ep2);

            var ps2 = new ProjectileSwitch (Front, xp + TileSize * (0.7), yp + TileSize * (11.5) , (sender, e) =>
                                            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep2.OnAction (e.Self, new ActionEventArgs (bstate, ep2));
            }, 2.5);

            ExtenderPlatform ep3 = new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 13, false);
            new ExtenderPlatform (Stage, xp + TileSize * (6), yp + TileSize * 13, ep3);

            var ps3 = new ProjectileSwitch (Front, xp + TileSize * (0.7), yp + TileSize * (11.5) , (sender, e) =>
                                            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep3.OnAction (e.Self, new ActionEventArgs (bstate, ep3));
            }, 7.5);

            ExtenderPlatform ep4 = new ExtenderPlatform (Stage, xp + TileSize * (0), yp + TileSize * 15, false);
            new ExtenderPlatform (Stage, xp + TileSize * (1), yp + TileSize * 15, ep4);
            new ExtenderPlatform (Stage, xp + TileSize * (3), yp + TileSize * 14, ep4);
            new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 15, ep4);
            new ExtenderPlatform (Stage, xp + TileSize * (6), yp + TileSize * 15, ep4);

            var ps4 = new ProjectileSwitch (Front, xp + TileSize * (0.7), yp + TileSize * (11.5) , (sender, e) =>
                                            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep4.OnAction (e.Self, new ActionEventArgs (bstate, ep4));
            }, 2.0);

            ExtenderPlatform ep5 = new ExtenderPlatform (Stage, xp + TileSize * (3), yp + TileSize * 16, false);

            var ps5 = new ProjectileSwitch (Front, xp + TileSize * (0.7), yp + TileSize * (11.5) , (sender, e) =>
                                            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep5.OnAction (e.Self, new ActionEventArgs (bstate, ep5));
            }, 3.0);

            ps1.Theta += MathHelper.Pi;
            ps2.Theta += MathHelper.Pi;
            ps3.Theta += MathHelper.Pi;
            ps4.Theta += MathHelper.Pi;
            ps5.Theta += MathHelper.Pi;

            FloorTile ft_door = new FloorTile (Rear, xp + TileSize * (3), yp + 8 + TileSize * 20);
            new ExtenderPlatform (Stage, xp + TileSize * (2), yp + TileSize * 17, true);
            new ExtenderPlatform (Stage, xp + TileSize * (2), yp + TileSize * 18, true);
            new ExtenderPlatform (Stage, xp + TileSize * (2), yp + TileSize * 19, true);
            new ExtenderPlatform (Stage, xp + TileSize * (4), yp + TileSize * 17, true);
            new ExtenderPlatform (Stage, xp + TileSize * (4), yp + TileSize * 18, true);
            new ExtenderPlatform (Stage, xp + TileSize * (4), yp + TileSize * 19, true);

            Scene next_scene = (Scene)_Game.Scenes["SceneEight"];
            _DoorToNextScene.CornerX = ft_door.CornerX;
            _DoorToNextScene.CornerY = ft_door.CornerY + TileSize;
            _DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #10
0
파일: SceneOne.cs 프로젝트: qwook/hungry
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = 0;
            PerimeterOffsetY = 0;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            // Set up doors:
            //Scene prev_scene = (Scene)Scene.Scenes["SceneOne"];
            //_DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;
            Scene next_scene = (Scene)_Game.Scenes["SceneTwo"];
            _DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
            _DoorToNextScene.Destination.Position = _DoorToNextScene.Position;

            yp += TileSize;

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, 36, 16, Texture.Get ("sprite_tile_bg_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 9) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 4) * TileSize;
            BackgroundTiles.Parallax = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            double recess_switch = -4.0;
            double recess_gw = -2.0;

            // Stage elements
            var ft0 = new FloorTile (Rear, xp, yp);
            FirstTile = ft0;
            new RadioProp(Rear, xp, yp + TileSize);
            var ft1 = new FloorTile (Rear, xp + TileSize, yp);
            var ft2 = new FloorTile (Rear, xp + 2 * TileSize, yp - TileSize * 0.5);

            // Control key indicators (info graphics)
            var infogfx_texture = Texture.Get("sprite_infogfx_cabinet_buttons");
            var a_infogfx = new SpriteBase(Rear, ft1.CornerX + TileSize, ft1.CornerY + TileSize, infogfx_texture).SetRegion("left");
            var d_infogfx = new SpriteBase(Rear, a_infogfx.CornerX + TileSize, a_infogfx.CornerY, infogfx_texture).SetRegion ("right");
            var w_infogfx = new SpriteBase(Rear, _DoorToNextScene.PositionX, _DoorToNextScene.CornerY + _DoorToNextScene.SizeY + 4, infogfx_texture).SetRegion ("do_action");

            // Gateways
            var gw1 = new Gateway (Front, xp + TileSize * 4, yp + recess_gw, false);
            var gw2 = new Gateway (Front, xp + TileSize * 10, yp + recess_gw, false);

            var fs00 = new PressureSwitch (Front, xp + TileSize * 3, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction (e.Self, new ActionEventArgs (bstate, gw1));
                //Console.WriteLine("{0} acted on {1}: {2}", sender, e.Self, e.Info);
            });
            var fs01 = new PressureSwitch (Front, xp + TileSize * 5, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction (e.Self, new ActionEventArgs (bstate, gw1));
                //Console.WriteLine("{0} acted on {1}: {2}", sender, e.Self, e.Info);
            }, fs00);

            var fs10 = new PressureSwitch (Front, xp + TileSize * 7, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
                //Console.WriteLine("{0} acted on {1}: {2}", sender, e.Self, e.Info);
            }, 0.2);

            var fs11 = new PressureSwitch (Front, xp + TileSize * 9 + 14, yp + recess_switch + TileSize * 3, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
                //Console.WriteLine("{0} acted on {1}: {2}", sender, e.Self, e.Info);
            }, fs10, 3.0);

            var space_infogfx = new SpriteBase (Rear, xp + fs11.PositionX - 128, yp + fs10.PositionY, infogfx_texture).SetRegion("jump");

            fs11.Theta = Math.PI * 0.5;
            var fs12 = new PressureSwitch (Front, xp + TileSize * 12, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
                //Console.WriteLine("{0} acted on {1}: {2}", sender, e.Self, e.Info);
            }, fs11);

            // Walls above gateways
            for (int i = 0; i < 5; i++) {
                new FloorTile (Rear, gw1.CornerX, gw1.CornerY + (2 + i) * TileSize + 8);
                new FloorTile (Rear, gw2.CornerX, gw2.CornerY + (2 + i) * TileSize + 8);
            }

            //var TestDialog = new Dialog(HUD, "Test", null);
            //TestDialog.RenderSet = HUD;
            //TestDialog.PauseTime = 1.0f;

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #11
0
        protected override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;
            PerimeterOffsetX = 100;
            PerimeterOffsetY = -8;
            PerimeterX = 8;
            PerimeterY = 40;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp += TileSize * PerimeterX - (TileSize * 1);
            yp -= TileSize * 3;

            // Set up previous door:
            Scene prev_scene = (Scene)Program.MainGame.Scenes["SceneFive"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, 48, 24, Texture.Get ("sprite_tile_bg2_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 24) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 4) * TileSize;
            BackgroundTiles.PositionZ = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            // Control key indicators (info graphics)
            var f_infogfx = new SpriteBase(Rear, xp - 2 * TileSize, yp, Texture.Get("sprite_infogfx_key_f"));

            // Top platform set
            ExtenderPlatform last_platform_0 = new ExtenderPlatform (Stage, xp + TileSize * (-3), yp + TileSize * 6, true);
            new ExtenderPlatform (Stage, xp + TileSize * (6), yp + TileSize * -2, last_platform_0);

            var bs_lower0 = new ProjectileSwitch (Front, xp + TileSize * (16.5), yp + TileSize * (11 + 0.5) , (sender, e) =>
                                                  {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_0.OnAction (e.Self, new ActionEventArgs (bstate, last_platform_0));
                //bool bstate_bs_lower_0 = last_platform_2.State != SwitchState.Open;
                //gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_0, gw_lower1));
            }, 0.1);

            // Platform set below top
            ExtenderPlatform last_platform_1 = new ExtenderPlatform (Stage, xp + TileSize * (0), yp + TileSize * 8, true);
            new ExtenderPlatform (Stage, xp + TileSize * (1), yp + TileSize * 8, last_platform_1);

            var bs_lower1 = new ProjectileSwitch (Front, xp + TileSize * (22.5), yp + TileSize * (7 + 0.5) , (sender, e) =>
                                                  {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_1.OnAction (e.Self, new ActionEventArgs (bstate, last_platform_1));
                //bool bstate_bs_lower_0 = last_platform_2.State != SwitchState.Open;
                //gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_0, gw_lower1));
            }, 0.1);

            double recess_switch = -4.0;
            double recess_gw = -2.0;

            var i = 8;

            new FloorTile (Rear, xp - TileSize * 1, yp + 2 * TileSize + 8 + i);
            new FloorTile (Rear, xp - TileSize * 0, yp + 2 * TileSize + 8 + i);
            var ft_door = new FloorTile (Rear, xp + TileSize * 1, yp + 2 * TileSize + 8 + i);
            new FloorTile (Rear, xp + TileSize * 2, yp + 2 * TileSize + 8 + i);
            //new FloorTile (Rear, xp + TileSize, yp + 2 * TileSize + 8);

            //Scene next_scene = (Scene)Program.MainGame.Scenes["SceneSeven"];
            //_DoorToNextScene = new Door(Rear, x0 + TileSize * 76, y1 + TileSize, next_scene.DoorToPreviousScene);
            //_DoorToNextScene = new Door(Rear, ft_door.CornerX, ft_door.CornerY + TileSize, next_scene.DoorToPreviousScene);
            //_DoorToNextScene.Destination.Position += _DoorToNextScene.Position;

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #12
0
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = 102;
            PerimeterOffsetY = -100;
            PerimeterX       = 30;
            PerimeterY       = 10;
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Setup background tiles
            var BackgroundTiles = new TileMap(Background, 48, 24, Texture.Get("sprite_tile_bg2_atlas"));

            BackgroundTiles.PositionX = (PerimeterOffsetX - 24) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 4) * TileSize;
            BackgroundTiles.Parallax  = 1.0;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes["SceneFive"];

            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp = x0 + TileSize * 0;
            yp = y0 + TileSize * 0;

            new FloorTile(Rear, xp + TileSize * (6 - 1), yp + TileSize * 1);
            new FloorTile(Rear, xp + TileSize * 6, yp + TileSize * 1);
            new FloorTile(Rear, xp + TileSize * 6, yp + TileSize * 2);
            new FloorTile(Rear, xp + TileSize * 6, yp + TileSize * 3);
            new FloorTile(Rear, xp + TileSize * (6 + 1), yp + TileSize * 1);
            new FloorTile(Rear, xp + TileSize * (6 + 1), yp + TileSize * 2);
            new FloorTile(Rear, xp + TileSize * (6 + 2), yp + TileSize * 1);

            //new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 1, false);
            ExtenderPlatform ep0 = new ExtenderPlatform(Stage, xp + TileSize * (5), yp + TileSize * 2, false);

            new ExtenderPlatform(Stage, xp + TileSize * (5), yp + TileSize * 3, ep0);
            //new ExtenderPlatform (Stage, xp + TileSize * (5), yp + TileSize * 4, ep0);

            var fs0 = new PressureSwitch(Front, xp + TileSize * 5, yp + TileSize * 2, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep0.OnAction(e.Self, new ActionEventArgs(bstate, ep0));
            }, 3.0);



            ExtenderPlatform ep1 = new ExtenderPlatform(Stage, xp + TileSize * (8), yp + TileSize * 3, false);

            new ExtenderPlatform(Stage, xp + TileSize * (9), yp + TileSize * 3, ep1);
            new ExtenderPlatform(Stage, xp + TileSize * (12), yp + TileSize * 3, ep1);
            new ExtenderPlatform(Stage, xp + TileSize * (13), yp + TileSize * 3, ep1);
            ExtenderPlatform ep2 = new ExtenderPlatform(Stage, xp + TileSize * (16), yp + TileSize * 4, false);

            new ExtenderPlatform(Stage, xp + TileSize * (17), yp + TileSize * 4, ep2);
            //new ExtenderPlatform (Stage, xp + TileSize * (20), yp + TileSize * 5, ep2);
            ExtenderPlatform ep3 = new ExtenderPlatform(Stage, xp + TileSize * (21), yp + TileSize * 4.5, false);

            new ExtenderPlatform(Stage, xp + TileSize * (25), yp + TileSize * 4, ep3);
            new ExtenderPlatform(Stage, xp + TileSize * (26), yp + TileSize * 4, ep3);

            var fs1 = new PressureSwitch(Front, xp + TileSize * 6, yp + TileSize * 4, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep1.OnAction(e.Self, new ActionEventArgs(bstate, ep1));
            }, 2.0);

            var fs2 = new PressureSwitch(Front, xp + TileSize * 6, yp + TileSize * 4, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep2.OnAction(e.Self, new ActionEventArgs(bstate, ep2));
            }, 3.0);

            var fs3 = new PressureSwitch(Front, xp + TileSize * 6, yp + TileSize * 4, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep3.OnAction(e.Self, new ActionEventArgs(bstate, ep3));
            }, 4.5);

            //new FloorTile (Rear, xp + TileSize * 25, yp + 6 * TileSize);
            //new FloorTile (Rear, xp + TileSize * 26, yp + 6 * TileSize);
            new FloorTile(Rear, xp + TileSize * 27, yp + 4 * TileSize);
            var ft_door = new FloorTile(Rear, xp + TileSize * 28, yp + 4 * TileSize);

            new FloorTile(Rear, xp + TileSize * 29, yp + 4 * TileSize);

            Scene next_scene = (Scene)_Game.Scenes["SceneSeven"];

            _DoorToNextScene.CornerX             = ft_door.CornerX;
            _DoorToNextScene.CornerY             = ft_door.CornerY + TileSize;
            _DoorToNextScene.Destination         = next_scene.DoorToPreviousScene;
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;



            // Call the base class initializer
            base.InitializeScene();
        }
예제 #13
0
파일: SceneFive.cs 프로젝트: peges/hungry
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer

            // Testing:
            PerimeterOffsetX = 102 + 3 - PerimeterX;
            PerimeterOffsetY = -7 + 3 - PerimeterY;


            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp += TileSize * (PerimeterX - 1);
            yp += TileSize * (PerimeterY - 4);

            {
                int i, j;

                new BunkerFloor(this, xp, yp);
                new BunkerFloor(this, xp, yp + TileSize);
                new BunkerFloor(this, xp, yp + 2 * TileSize);

                for (i = 0; i < 10; i++)
                {
                    new BunkerFloor(this, xp -= TileSize, yp);
                }

                new RadioProp(Stage, xp, yp + TileSize);
                xp -= TileSize * 2;

                yp += TileSize * (-3.5);
                var ep1 = new ExtenderPlatform(this.Rear, xp, yp, true);
                for (i += 3; i > 1; i--)
                {
                    new ExtenderPlatform(this.Rear, xp += TileSize, yp, ep1);
                }
                yp += TileSize;
                double yp1 = yp;
                double xp1 = xp;
                var    bs1 = new ProjectileSwitch(this.Front, xp + TileSize, yp + 2 * TileSize, (sender, e) => {
                    _Game.AddUpdateEventHandler(this, (ueh_sender, ueh_e) => {           // GL context
                        var bs2 = new ProjectileSwitch(this.Front, xp1 - 11.5 * TileSize, yp1 + 2 * TileSize, (sender1, e1) => {
                            _Game.AddUpdateEventHandler(this, (ueh2_sender, ueh2_e) => { // GL context
                                var ps1 = new PressureSwitch(this.Front, xp1 - 5 * TileSize, yp1 + 4, (sender2, e2) => {
                                    bool bstate = (SwitchState)e2.Info == SwitchState.Open;
                                    ep1.OnAction(e2.Self, new ActionEventArgs(bstate, ep1));
                                }, 1.0);
                                return(true);
                            });
                        }, 1.0).CenterShift();
                        bs2.PositionX -= 0.5 * bs2.SizeX;
                        bs2.Theta      = MathHelper.Pi;
                        return(true);
                    });
                }, 1.0).CenterShift();

                yp -= 7 * TileSize;

                for (i = 0; i < 10; i++)
                {
                    new BunkerFloor(this, xp -= TileSize, yp);
                }
            }



            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes["SceneFour"];

            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Setup background tiles
            var BackgroundTiles = new FadedTileMap(Background, PerimeterX + 20, PerimeterY + 12, Texture.Get("sprite_tile_bg2_atlas"));

            BackgroundTiles.PositionX = (PerimeterOffsetX - 18) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 2) * TileSize;
            BackgroundTiles.Parallax  = 1.0;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();


            // Basic perimeter:
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            for (int i = 0; i < PerimeterX; i++)
            {
                BunkerFloor block = new BunkerFloor2(this, x0 + TileSize * i, y0);
                block.PositionY -= block.SizeY;
                block            = new BunkerFloor(this, x0 + TileSize * i, y0);
            }
            for (int i = 0; i <= PerimeterY; i++)
            {
                BunkerWall wall;

                wall = new BunkerWall(this, x0 - 0.5 * TileSize, y0 + TileSize * (PerimeterY - i));
                if (i > 0 && i < 3)
                {
                    continue;
                }
                wall       = new BunkerWall(this, x0 + TileSize * PerimeterX, y0 + TileSize * i);
                wall.TileX = -1.0;
            }
            for (int i = 0; i < PerimeterX; i++)
            {
                var block = new FloorTile(Stage, x0 + TileSize * (PerimeterX - i - 1), y0 + TileSize * PerimeterY);
            }

            new FloorTile(Stage, x0 + TileSize * (PerimeterX - 1), y0 + TileSize * 1);
            new FloorTile(Stage, x0 + TileSize * (PerimeterX - 1), y0 + TileSize * 2);
            new FloorTile(Stage, x0 + TileSize * (PerimeterX - 1), y0 + TileSize * 3);


            Scene next_scene = (Scene)_Game.Scenes["SceneSix"];

            //_DoorToNextScene = new Door(Rear, 0 , y0 + TileSize * -76, next_scene.DoorToPreviousScene);
            _DoorToNextScene.CornerX             = _DoorToPreviousScene.CornerX;
            _DoorToNextScene.CornerY             = _DoorToPreviousScene.PositionY + TileSize * -93.5;
            _DoorToNextScene.Destination         = next_scene.DoorToPreviousScene;
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;


            // Call the base class initializer
            base.InitializeScene();
        }
예제 #14
0
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = 125;
            PerimeterOffsetY = -96;
            PerimeterX       = 7;
            PerimeterY       = 30;
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Setup background tiles
            var BackgroundTiles = new TileMap(Background, 48, 24, Texture.Get("sprite_tile_bg2_atlas"));

            BackgroundTiles.PositionX = (PerimeterOffsetX - 24) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY + 10) * TileSize;
            BackgroundTiles.Parallax  = 1.0;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes["SceneSix"];

            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp = x0 + TileSize * 0;
            yp = y0 + TileSize * 0;

            ExtenderPlatform ep0 = new ExtenderPlatform(Stage, xp + TileSize * (0), yp + TileSize * 1, false);

            new ExtenderPlatform(Stage, xp + TileSize * (1), yp + TileSize * 1, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (3), yp + TileSize * 2, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (5), yp + TileSize * 3, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (6), yp + TileSize * 3, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (3), yp + TileSize * 4, ep0);

            new ExtenderPlatform(Stage, xp + TileSize * (0), yp + TileSize * 3, true);
            new ExtenderPlatform(Stage, xp + TileSize * (1), yp + TileSize * 3, true);

            new ExtenderPlatform(Stage, xp + TileSize * (5), yp + TileSize * 5, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (6), yp + TileSize * 5, ep0);
            new ExtenderPlatform(Stage, xp + TileSize * (3), yp + TileSize * 6, ep0);

            new FloorTile(Rear, xp + TileSize * (0), yp + TileSize * 7);
            new FloorTile(Rear, xp + TileSize * (0), yp + TileSize * 8);
            new FloorTile(Rear, xp + TileSize * (0), yp + TileSize * 9);
            new FloorTile(Rear, xp + TileSize * (0), yp + TileSize * 10);
            new FloorTile(Rear, xp + TileSize * (0), yp + TileSize * 11);
            new FloorTile(Rear, xp + TileSize * (1), yp + TileSize * 7);

            new ExtenderPlatform(Stage, xp + TileSize * (1), yp + TileSize * 8, true);
            new ExtenderPlatform(Stage, xp + TileSize * (1), yp + TileSize * 9, true);

            new FloorTile(Rear, xp + TileSize * (2), yp + TileSize * 10);
            new FloorTile(Rear, xp + TileSize * (3), yp + TileSize * 10);
            new FloorTile(Rear, xp + TileSize * (4), yp + TileSize * 10);
            new FloorTile(Rear, xp + TileSize * (5), yp + TileSize * 10);
            new FloorTile(Rear, xp + TileSize * (6), yp + TileSize * 10);

            var ps0 = new ProjectileSwitch(Front, xp + TileSize * (6.25), yp + TileSize * (1.25), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep0.OnAction(e.Self, new ActionEventArgs(bstate, ep0));
            }, 2.5);

            ExtenderPlatform ep1 = new ExtenderPlatform(Stage, xp + TileSize * (5), yp + TileSize * 11, false);

            new ExtenderPlatform(Stage, xp + TileSize * (6), yp + TileSize * 11, ep1);

            var ps1 = new ProjectileSwitch(Front, xp + TileSize * (0.7), yp + TileSize * (11.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep1.OnAction(e.Self, new ActionEventArgs(bstate, ep1));
            }, 1.0);

            ExtenderPlatform ep2 = new ExtenderPlatform(Stage, xp + TileSize * (3), yp + TileSize * 12, false);

            new ExtenderPlatform(Stage, xp + TileSize * (0), yp + TileSize * 13, ep2);
            new ExtenderPlatform(Stage, xp + TileSize * (1), yp + TileSize * 13, ep2);

            var ps2 = new ProjectileSwitch(Front, xp + TileSize * (0.7), yp + TileSize * (11.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep2.OnAction(e.Self, new ActionEventArgs(bstate, ep2));
            }, 2.5);

            ExtenderPlatform ep3 = new ExtenderPlatform(Stage, xp + TileSize * (5), yp + TileSize * 13, false);

            new ExtenderPlatform(Stage, xp + TileSize * (6), yp + TileSize * 13, ep3);

            var ps3 = new ProjectileSwitch(Front, xp + TileSize * (0.7), yp + TileSize * (11.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep3.OnAction(e.Self, new ActionEventArgs(bstate, ep3));
            }, 7.5);

            ExtenderPlatform ep4 = new ExtenderPlatform(Stage, xp + TileSize * (0), yp + TileSize * 15, false);

            new ExtenderPlatform(Stage, xp + TileSize * (1), yp + TileSize * 15, ep4);
            new ExtenderPlatform(Stage, xp + TileSize * (3), yp + TileSize * 14, ep4);
            new ExtenderPlatform(Stage, xp + TileSize * (5), yp + TileSize * 15, ep4);
            new ExtenderPlatform(Stage, xp + TileSize * (6), yp + TileSize * 15, ep4);

            var ps4 = new ProjectileSwitch(Front, xp + TileSize * (0.7), yp + TileSize * (11.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep4.OnAction(e.Self, new ActionEventArgs(bstate, ep4));
            }, 2.0);

            ExtenderPlatform ep5 = new ExtenderPlatform(Stage, xp + TileSize * (3), yp + TileSize * 16, false);

            var ps5 = new ProjectileSwitch(Front, xp + TileSize * (0.7), yp + TileSize * (11.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                ep5.OnAction(e.Self, new ActionEventArgs(bstate, ep5));
            }, 3.0);

            ps1.Theta += MathHelper.Pi;
            ps2.Theta += MathHelper.Pi;
            ps3.Theta += MathHelper.Pi;
            ps4.Theta += MathHelper.Pi;
            ps5.Theta += MathHelper.Pi;


            FloorTile ft_door = new FloorTile(Rear, xp + TileSize * (3), yp + 8 + TileSize * 20);

            new ExtenderPlatform(Stage, xp + TileSize * (2), yp + TileSize * 17, true);
            new ExtenderPlatform(Stage, xp + TileSize * (2), yp + TileSize * 18, true);
            new ExtenderPlatform(Stage, xp + TileSize * (2), yp + TileSize * 19, true);
            new ExtenderPlatform(Stage, xp + TileSize * (4), yp + TileSize * 17, true);
            new ExtenderPlatform(Stage, xp + TileSize * (4), yp + TileSize * 18, true);
            new ExtenderPlatform(Stage, xp + TileSize * (4), yp + TileSize * 19, true);



            Scene next_scene = (Scene)_Game.Scenes["SceneEight"];

            _DoorToNextScene.CornerX             = ft_door.CornerX;
            _DoorToNextScene.CornerY             = ft_door.CornerY + TileSize;
            _DoorToNextScene.Destination         = next_scene.DoorToPreviousScene;
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;



            // Call the base class initializer
            base.InitializeScene();
        }
예제 #15
0
        protected override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer

            // Testing:
            PerimeterOffsetX = 102 + 3 - PerimeterX;
            PerimeterOffsetY = -7 + 3 - PerimeterY;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp += TileSize * (PerimeterX - 1);
            yp += TileSize * (PerimeterY - 4);

            {
                int i, j;

                new BunkerFloor(this, xp, yp);
                new BunkerFloor(this, xp, yp + TileSize);
                new BunkerFloor(this, xp, yp + 2 * TileSize);

                for(i = 0; i < 10; i++)
                    new BunkerFloor(this, xp -= TileSize, yp);

                new RadioProp(Stage, xp, yp + TileSize);
                xp -= TileSize * 2;

                yp += TileSize * (-3.5);
                var ep1 = new ExtenderPlatform(this.Rear, xp, yp, true);
                for(i += 3; i > 1; i--)
                {
                    new ExtenderPlatform(this.Rear, xp += TileSize, yp, ep1);
                }
                yp += TileSize;
                double yp1 = yp;
                double xp1 = xp;
                var bs1 = new ProjectileSwitch(this.Front, xp + TileSize, yp + 2 * TileSize, (sender, e) => {
                    Program.MainGame.AddUpdateEventHandler(this, (ueh_sender, ueh_e) => { // GL context
                        var bs2 = new ProjectileSwitch(this.Front, xp1 - 11.5 * TileSize, yp1 + 2 * TileSize, (sender1, e1)=>{
                            Program.MainGame.AddUpdateEventHandler(this, (ueh2_sender, ueh2_e) => { // GL context
                                var ps1 = new PressureSwitch(this.Front, xp1 - 5 * TileSize, yp1 + 4, (sender2, e2) => {
                                    bool bstate = (SwitchState)e2.Info == SwitchState.Open;
                                    ep1.OnAction (e2.Self, new ActionEventArgs (bstate, ep1));
                                }, 1.0);
                                return true;
                            });
                        }, 1.0).CenterShift();
                        bs2.PositionX -= 0.5 * bs2.SizeX;
                        bs2.Theta = MathHelper.Pi;
                        return true;
                    });
                }, 1.0).CenterShift();

                yp -= 7 * TileSize;

                for(i = 0; i < 10; i++)
                    new BunkerFloor(this, xp -= TileSize, yp);

            }

            // Set up previous door:
            Scene prev_scene = (Scene)Program.MainGame.Scenes["SceneFour"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Setup background tiles
            var BackgroundTiles = new FadedTileMap (Background, PerimeterX + 20, PerimeterY + 12, Texture.Get ("sprite_tile_bg2_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 18) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 2) * TileSize;
            BackgroundTiles.PositionZ = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            // Basic perimeter:
            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;
            for (int i = 0; i < PerimeterX; i++)
            {
                BunkerFloor block = new BunkerFloor2 (this, x0 + TileSize * i, y0);
                block.PositionY -= block.SizeY;
                block = new BunkerFloor (this, x0 + TileSize * i, y0);
            }
            for (int i = 0; i <= PerimeterY; i++)
            {
                BunkerWall wall;

                wall = new BunkerWall(this, x0 - 0.5 * TileSize, y0 + TileSize * (PerimeterY - i));
                if(i > 0 && i < 3)
                    continue;
                wall = new BunkerWall(this, x0 + TileSize * PerimeterX, y0 + TileSize * i);
                wall.TileX = -1.0;
            }
            for (int i = 0; i < PerimeterX; i++)
            {
                var block = new FloorTile(Stage, x0 + TileSize * (PerimeterX - i - 1), y0 + TileSize * PerimeterY);
            }

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #16
0
        protected override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer

            PerimeterOffsetX = 87;
            PerimeterOffsetY = -12;
            PerimeterX = 32;
            PerimeterY = 12;

            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp += TileSize * PerimeterX * 0.5 - (TileSize * 1);
            yp -= TileSize *2;

            // Set up previous door:
            Scene prev_scene = (Scene)Program.MainGame.Scenes["SceneThree"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, 48, 24, Texture.Get ("sprite_tile_bg4_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 18) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY ) * TileSize;
            BackgroundTiles.PositionZ = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            // Control key indicators (info graphics)
            var f_infogfx = new SpriteBase(Rear, xp - 2 * TileSize, yp, Texture.Get("sprite_infogfx_key_f"));

            // First Set of platforms
            double ep2x = xp - TileSize * 20;
            double ep2y = yp + TileSize;

            // Top platform set
            ExtenderPlatform last_platform_2 = new ExtenderPlatform (Stage, ep2x + TileSize * (5), ep2y + TileSize * 9, true);
            for (int i = 1; i < 12; i++) {
                new ExtenderPlatform (Stage, ep2x + TileSize * (5 + i), ep2y + TileSize * 9, last_platform_2);
            }

            var bs_lower0 = new ProjectileSwitch (Front, ep2x + TileSize * (16.5), ep2y + TileSize * (11 + 0.5) , (sender, e) =>
                                              {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_2.OnAction (e.Self, new ActionEventArgs (bstate, last_platform_2));
                //bool bstate_bs_lower_0 = last_platform_2.State != SwitchState.Open;
                //gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_0, gw_lower1));
            }, 0.1);

            // Platform set below top
            ExtenderPlatform last_platform_3 = new ExtenderPlatform (Stage, ep2x + TileSize * (5), ep2y + TileSize * 5, true);
            for (int i = 1; i < 12; i++) {
                new ExtenderPlatform (Stage, ep2x + TileSize * (5 + i), ep2y + TileSize * 5, last_platform_3);
            }

            var bs_lower1 = new ProjectileSwitch (Front, ep2x + TileSize * (22.5), ep2y + TileSize * (7 + 0.5) , (sender, e) =>
                                                  {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_3.OnAction (e.Self, new ActionEventArgs (bstate, last_platform_3));
                //bool bstate_bs_lower_0 = last_platform_2.State != SwitchState.Open;
                //gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_0, gw_lower1));
            }, 0.1);

            double recess_switch = -4.0;
            double recess_gw = -2.0;

            for (int i = 0; i < 12; i++) {
                var spidey = new Spidey (Stage, ep2x + (5 + i) * TileSize, ep2y + TileSize * 6);
                spidey.Body.BodyType = BodyType.Dynamic;
            }

            // Gateways
            var gw1 = new Gateway (Front, xp - TileSize * 3, yp + 3 * TileSize, false);
            var gw2 = new Gateway (Front, xp + TileSize * 3, yp + 3 * TileSize, false);

            // Walls above gateways
            for (int i = 2; i < 5; i++) {
                new FloorTile (Rear, gw1.CornerX, gw1.CornerY + (i) * TileSize + 8);
            }

            for (int i = 6; i < PerimeterY - 1; i++) {
                new FloorTile (Rear, gw1.CornerX, gw1.CornerY + (i) * TileSize + 8);
            }

            for (int i = 2; i < PerimeterY - 5; i++) {
                new FloorTile (Rear, gw2.CornerX, gw2.CornerY + (i) * TileSize + 8);
            }

            new FloorTile (Rear, gw2.CornerX - TileSize * 5, gw2.CornerY + 2 * TileSize + 8);
            new FloorTile (Rear, gw2.CornerX - TileSize * 4, gw2.CornerY + 2 * TileSize + 8);
            var ft_door = new FloorTile (Rear, gw2.CornerX - TileSize * 3, gw2.CornerY + 2 * TileSize + 8);
            new FloorTile (Rear, gw2.CornerX - TileSize * 2, gw2.CornerY + 2 * TileSize + 8);
            new FloorTile (Rear, gw2.CornerX - TileSize, gw2.CornerY + 2 * TileSize + 8);

            var fs10 = new PressureSwitch (Front, gw1.CornerX + TileSize, gw1.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction (e.Self, new ActionEventArgs (bstate, gw1));
            });
            var fs11 = new PressureSwitch (Front, gw1.CornerX - TileSize, gw1.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction (e.Self, new ActionEventArgs (bstate, gw1));
            }, fs10);

            var fs20 = new PressureSwitch (Front, gw2.CornerX - TileSize, gw2.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
            });
            var fs21 = new PressureSwitch (Front, gw2.CornerX + TileSize, gw2.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
            }, fs20);

            xp = fs21.CornerX + 2 * TileSize;
            yp += TileSize;
            xp += TileSize;

            var ft_room_r = new FloorTile (Stage, xp, yp + TileSize * 2);

            for (int i = 1; i < 8; i++)
                new FloorTile (Stage, xp + i * TileSize, yp + TileSize * 2);

            for (int i = 0; i < 4; i++)
                new FloorTile (Stage, xp + (i + 1) * TileSize, yp + TileSize * 3);
            //yp += 2 * TileSize;
            //xp += 4 * TileSize;

            for (int i = 0; i < 6; i++) {
                var spidey = new Spidey (Stage, xp + (5 + i) * TileSize, yp + TileSize * (3));
                spidey.Body.BodyType = BodyType.Dynamic;
            }

            ExtenderPlatform last_platform_0 = null;
            ExtenderPlatform last_platform_1 = null;
            for (int i = 0; i < 3; i++) {
                last_platform_0 = new ExtenderPlatform (Stage, xp + TileSize * (5 + i), yp + TileSize * (4.5 + i), last_platform_0);
            }

            xp -= 2 * TileSize;
            yp += TileSize;
            for (int i = 0; i < 9; i++) {
                last_platform_1 = new ExtenderPlatform (Stage, xp + TileSize * (-1 + i), yp + TileSize * (7), last_platform_1);
            }

            var fs30 = new PressureSwitch (Front, ft_room_r.CornerX, ft_room_r.CornerY + TileSize + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_1.OnAction (e.Self, new ActionEventArgs (bstate, last_platform_1));
            }, 6.0);

            var bs_lower2 = new ProjectileSwitch (Front, ep2x + TileSize * (23.55), ep2y + TileSize * (7 + 0.5) , (sender, e) =>
                                                  {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_0.OnAction (e.Self, new ActionEventArgs (bstate, last_platform_0));
            }, 3.0);
            //bs_lower2.CenterShift();
            bs_lower2.Theta += MathHelper.Pi;

            // Set up next door:
            /*(
            Scene next_scene = (Scene)Program.MainGame.Scenes["SceneThree"];
            _DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
            _DoorToNextScene.PositionX = last_platform_1.PositionX;
            _DoorToNextScene.CornerY = yp += last_platform_1.SizeY;

            // Update next scene's door position
            _DoorToNextScene.Destination.Position = _DoorToNextScene.Position;
            */
            Scene next_scene = (Scene)Program.MainGame.Scenes["SceneFive"];
            //Scene next_scene = (Scene)Program.MainGame.Scenes["SceneSix"];
            //_DoorToNextScene = new Door(Rear, x0 + TileSize * 76, y1 + TileSize, next_scene.DoorToPreviousScene);
            _DoorToNextScene = new Door(Rear, ft_door.CornerX, ft_door.CornerY + TileSize, next_scene.DoorToPreviousScene);
            _DoorToNextScene.Destination.Position += _DoorToNextScene.Position;

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #17
0
        protected override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer
            PerimeterOffsetX = -2;
            PerimeterOffsetY = 0;
            PerimeterX = 32;
            PerimeterY = 12;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp += TileSize * PerimeterX * 0.5;
            yp += TileSize;

            // Set up previous door:
            Scene prev_scene = (Scene)Program.MainGame.Scenes["SceneOne"];
            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Setup background tiles
            var BackgroundTiles = new TileMap (Background, 48, 24, Texture.Get ("sprite_tile_bg2_atlas"));
            BackgroundTiles.PositionX = (PerimeterOffsetX - 9) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY - 4) * TileSize;
            BackgroundTiles.PositionZ = 1.0;
            BackgroundTiles.RandomMap ();
            BackgroundTiles.Build ();

            // Control key indicators (info graphics)
            var infogfx_texture = Texture.Get("sprite_infogfx_cabinet_buttons");
            var f_infogfx = new SpriteBase(Rear, xp - 2 * TileSize, yp, infogfx_texture).SetRegion("use_equipped_item");

            // Get cross-scene variables
            Scene previous_scene = (Scene)Program.MainGame.Scenes["SceneOne"];

            double recess_switch = -4.0;
            double recess_gw = -2.0;

            for (int i = 0; i < 5; i++) {
                var spidey = new Spidey (Stage, xp - (5 + 0.25 * i) * TileSize, yp);
                spidey.Body.BodyType = BodyType.Dynamic;
            }

            // Gateways
            var gw1 = new Gateway (Front, xp - TileSize * 3, yp + recess_gw, false);
            var gw2 = new Gateway (Front, xp + TileSize * 3, yp + recess_gw, false);

            // Walls above gateways
            for (int i = 2; i < PerimeterY - 1; i++) {
                new FloorTile (Rear, gw1.CornerX, gw1.CornerY + (i) * TileSize + 8);
                new FloorTile (Rear, gw2.CornerX, gw2.CornerY + (i) * TileSize + 8);
            }

            var fs10 = new PressureSwitch (Front, gw1.CornerX + TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction (e.Self, new ActionEventArgs (bstate, gw1));
            });
            var fs11 = new PressureSwitch (Front, gw1.CornerX - TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction (e.Self, new ActionEventArgs (bstate, gw1));
            }, fs10);

            var fs20 = new PressureSwitch (Front, gw2.CornerX - TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
            });
            var fs21 = new PressureSwitch (Front, gw2.CornerX + TileSize, yp + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction (e.Self, new ActionEventArgs (bstate, gw2));
            }, fs20);

            xp = fs21.CornerX + 2 * TileSize;

            var ft_room_r = new FloorTile (Stage, xp, yp);
            for (int i = 1; i < 8; i++)
                new FloorTile (Stage, xp + i * TileSize, yp);

            yp += TileSize;
            xp += TileSize;

            for (int i = 0; i < 4; i++)
                new FloorTile (Stage, xp + (i + 1) * TileSize, yp);
            //yp += 2 * TileSize;
            xp += 4 * TileSize;

            ExtenderPlatform last_platform_0 = null;
            ExtenderPlatform last_platform_1 = null;
            for (int i = 0; i < 3; i++) {
                last_platform_0 = new ExtenderPlatform (Stage, xp += TileSize, yp += TileSize, last_platform_0);
            }
            xp -= 2 * TileSize;
            yp += TileSize;
            for (int i = 0; i < 6; i++) {
                last_platform_1 = new ExtenderPlatform (Stage, xp -= TileSize, yp, true);
            }

            // Set up next door:
            Scene next_scene = (Scene)Program.MainGame.Scenes["SceneThree"];
            _DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
            _DoorToNextScene.PositionX = last_platform_1.PositionX;
            _DoorToNextScene.CornerY = yp += last_platform_1.SizeY;

            // Update next scene's door position relative to its -initial- position (set with constructor/instantiation)
            _DoorToNextScene.Destination.Corner += _DoorToNextScene.Corner;

            var fs30 = new PressureSwitch (Front, ft_room_r.CornerX + TileSize, ft_room_r.CornerY + TileSize + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_0.OnAction (e.Self, new ActionEventArgs (bstate, last_platform_0));
            }, 5.0);

            // Call the base class initializer
            base.InitializeScene ();
        }
예제 #18
0
        public override void InitializeScene()
        {
            // Assign base class variables here, before calling the base class initializer

            PerimeterOffsetX = 87;
            PerimeterOffsetY = -12;
            PerimeterX       = 32;
            PerimeterY       = 12;

            double x0 = PerimeterOffsetX * TileSize;
            double y0 = PerimeterOffsetY * TileSize;

            // Store width and height in local variables for easy access
            int w_i = (int)ViewWidth;
            int h_i = (int)ViewHeight;

            // X and Y positioner variables
            double xp = TileSize * PerimeterOffsetX;
            double yp = TileSize * PerimeterOffsetY;

            xp += TileSize * PerimeterX * 0.5 - (TileSize * 1);
            yp -= TileSize * 2;

            // Set up previous door:
            Scene prev_scene = (Scene)_Game.Scenes["SceneThree"];

            _DoorToPreviousScene.Destination = prev_scene.DoorToNextScene;

            // Setup background tiles
            var BackgroundTiles = new TileMap(Background, 48, 24, Texture.Get("sprite_tile_bg4_atlas"));

            BackgroundTiles.PositionX = (PerimeterOffsetX - 18) * TileSize;
            BackgroundTiles.PositionY = (PerimeterOffsetY) * TileSize;
            BackgroundTiles.Parallax  = 1.0;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();

            // Control key indicators (info graphics)
            var f_infogfx = new SpriteBase(Rear, xp - 2 * TileSize, yp, Texture.Get("sprite_infogfx_key_f"));


            // First Set of platforms
            double ep2x = xp - TileSize * 20;
            double ep2y = yp + TileSize;


            // Top platform set
            ExtenderPlatform last_platform_2 = new ExtenderPlatform(Stage, ep2x + TileSize * (5), ep2y + TileSize * 9, true);

            for (int i = 1; i < 12; i++)
            {
                new ExtenderPlatform(Stage, ep2x + TileSize * (5 + i), ep2y + TileSize * 9, last_platform_2);
            }

            var bs_lower0 = new ProjectileSwitch(Front, ep2x + TileSize * (16.5), ep2y + TileSize * (11 + 0.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_2.OnAction(e.Self, new ActionEventArgs(bstate, last_platform_2));
                //bool bstate_bs_lower_0 = last_platform_2.State != SwitchState.Open;
                //gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_0, gw_lower1));
            }, 0.1);

            // Platform set below top
            ExtenderPlatform last_platform_3 = new ExtenderPlatform(Stage, ep2x + TileSize * (5), ep2y + TileSize * 5, true);

            for (int i = 1; i < 12; i++)
            {
                new ExtenderPlatform(Stage, ep2x + TileSize * (5 + i), ep2y + TileSize * 5, last_platform_3);
            }

            var bs_lower1 = new ProjectileSwitch(Front, ep2x + TileSize * (22.5), ep2y + TileSize * (7 + 0.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_3.OnAction(e.Self, new ActionEventArgs(bstate, last_platform_3));
                //bool bstate_bs_lower_0 = last_platform_2.State != SwitchState.Open;
                //gw_lower1.OnAction (e.Self, new ActionEventArgs (bstate || bstate_bs_lower_0, gw_lower1));
            }, 0.1);

            double recess_switch = -4.0;
            double recess_gw     = -2.0;

            for (int i = 0; i < 12; i++)
            {
                new Spidey(Stage, ep2x + (5 + i) * TileSize, ep2y + TileSize * 6);
            }

            // Gateways
            var gw1 = new Gateway(Front, xp - TileSize * 3, yp + 3 * TileSize, false);
            var gw2 = new Gateway(Front, xp + TileSize * 3, yp + 3 * TileSize, false);

            // Walls above gateways
            for (int i = 2; i < 5; i++)
            {
                new FloorTile(Rear, gw1.CornerX, gw1.CornerY + (i) * TileSize + 8);
            }

            for (int i = 6; i < PerimeterY - 1; i++)
            {
                new FloorTile(Rear, gw1.CornerX, gw1.CornerY + (i) * TileSize + 8);
            }

            for (int i = 2; i < PerimeterY - 5; i++)
            {
                new FloorTile(Rear, gw2.CornerX, gw2.CornerY + (i) * TileSize + 8);
            }


            new FloorTile(Rear, gw2.CornerX - TileSize * 5, gw2.CornerY + 2 * TileSize + 8);
            new FloorTile(Rear, gw2.CornerX - TileSize * 4, gw2.CornerY + 2 * TileSize + 8);
            var ft_door = new FloorTile(Rear, gw2.CornerX - TileSize * 3, gw2.CornerY + 2 * TileSize + 8);

            new FloorTile(Rear, gw2.CornerX - TileSize * 2, gw2.CornerY + 2 * TileSize + 8);
            new FloorTile(Rear, gw2.CornerX - TileSize, gw2.CornerY + 2 * TileSize + 8);

            var fs10 = new PressureSwitch(Front, gw1.CornerX + TileSize, gw1.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction(e.Self, new ActionEventArgs(bstate, gw1));
            });
            var fs11 = new PressureSwitch(Front, gw1.CornerX - TileSize, gw1.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw1.OnAction(e.Self, new ActionEventArgs(bstate, gw1));
            }, fs10);

            var fs20 = new PressureSwitch(Front, gw2.CornerX - TileSize, gw2.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction(e.Self, new ActionEventArgs(bstate, gw2));
            });
            var fs21 = new PressureSwitch(Front, gw2.CornerX + TileSize, gw2.CornerY + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                gw2.OnAction(e.Self, new ActionEventArgs(bstate, gw2));
            }, fs20);

            xp  = fs21.CornerX + 2 * TileSize;
            yp += TileSize;
            xp += TileSize;

            var ft_room_r = new FloorTile(Stage, xp, yp + TileSize * 2);


            for (int i = 1; i < 8; i++)
            {
                new FloorTile(Stage, xp + i * TileSize, yp + TileSize * 2);
            }

            for (int i = 0; i < 4; i++)
            {
                new FloorTile(Stage, xp + (i + 1) * TileSize, yp + TileSize * 3);
            }
            //yp += 2 * TileSize;
            //xp += 4 * TileSize;

            for (int i = 0; i < 6; i++)
            {
                new Spidey(Stage, xp + (5 + i) * TileSize, yp + TileSize * (3));
            }

            ExtenderPlatform last_platform_0 = null;
            ExtenderPlatform last_platform_1 = null;

            for (int i = 0; i < 3; i++)
            {
                last_platform_0 = new ExtenderPlatform(Stage, xp + TileSize * (5 + i), yp + TileSize * (4.5 + i), last_platform_0);
            }

            xp -= 2 * TileSize;
            yp += TileSize;
            for (int i = 0; i < 9; i++)
            {
                last_platform_1 = new ExtenderPlatform(Stage, xp + TileSize * (-1 + i), yp + TileSize * (7), last_platform_1);
            }

            var fs30 = new PressureSwitch(Front, ft_room_r.CornerX, ft_room_r.CornerY + TileSize + recess_switch, (sender, e) => {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_1.OnAction(e.Self, new ActionEventArgs(bstate, last_platform_1));
            }, 6.0);

            var bs_lower2 = new ProjectileSwitch(Front, ep2x + TileSize * (23.55), ep2y + TileSize * (7 + 0.5), (sender, e) =>
            {
                bool bstate = (SwitchState)e.Info != SwitchState.Open;
                last_platform_0.OnAction(e.Self, new ActionEventArgs(bstate, last_platform_0));
            }, 3.0);

            //bs_lower2.CenterShift();
            bs_lower2.Theta += MathHelper.Pi;

            // Set up next door:

            /*(
             * Scene next_scene = (Scene)Program.MainGame.Scenes["SceneThree"];
             * _DoorToNextScene.Destination = next_scene.DoorToPreviousScene;
             * _DoorToNextScene.PositionX = last_platform_1.PositionX;
             * _DoorToNextScene.CornerY = yp += last_platform_1.SizeY;
             *
             * // Update next scene's door position
             * _DoorToNextScene.Destination.Position = _DoorToNextScene.Position;
             */
            Scene next_scene = (Scene)_Game.Scenes["SceneFive"];

            //Scene next_scene = (Scene)Program.MainGame.Scenes["SceneSix"];
            //_DoorToNextScene = new Door(Rear, x0 + TileSize * 76, y1 + TileSize, next_scene.DoorToPreviousScene);
            _DoorToNextScene         = new Door(Rear, ft_door.CornerX, ft_door.CornerY + TileSize, next_scene.DoorToPreviousScene);
            _DoorToNextScene.CornerX = ft_door.CornerX;
            _DoorToNextScene.CornerY = ft_door.CornerY + TileSize;
            _DoorToNextScene.Destination.Position += _DoorToNextScene.Position;



            // Call the base class initializer
            base.InitializeScene();
        }