Ejemplo n.º 1
0
 public SpriteObject(RenderSet render_set, SpriteObject relative_to, double x, double y, Texture texture)
     : this(render_set, x, y, texture)
 {
     Corner = new Vector3d(relative_to.CornerX + x, relative_to.CornerY + y, relative_to.PositionZ);;
 }
Ejemplo n.º 2
0
        public override void InitializeScene()
        {
            // 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;

            var headquarters = new HeadquartersBuilding(Rear, 0.0, 0.0);

            // Setup background

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

            BackgroundTiles.PositionX = -9 * TileSize;
            BackgroundTiles.PositionY = 0.0;
            BackgroundTiles.Parallax  = 100;
            BackgroundTiles.RandomMap();
            BackgroundTiles.Build();

            double far_x = 0.0;
            var    BackgroundBuildings = new List <BoringBuilding>();
            {
                double x_o = headquarters.CornerX + headquarters.SizeX;
                for (int i = 0; i < 20; i++)
                {
                    var b = new BoringBuilding(this, x_o, 0.0);
                    BackgroundBuildings.Add(b);
                    x_o += b.SizeX;
                }
                far_x = x_o;
            }

            {
                double x_o = -128;
                while (x_o < far_x)
                {
                    var b = new SideWalkTile(Stage, x_o, -TileSize);
                    x_o += b.SizeX;
                    if (FirstTile == null)
                    {
                        FirstTile = b;
                    }
                }
            }

            // Control key indicators (info graphics)
            var infogfx_texture = Texture.Get("sprite_infogfx_cabinet_buttons");
            var a_infogfx       = new SpriteBase(Rear, 4 * TileSize, 2 * 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");

            int[,] map = new int[, ] {
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 4, 0, 0, 0, 4, 0, 0, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 },
                { 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
            };

            // Tiles
            int width  = map.GetLength(1);
            int height = map.Length / width;

            for (int y = 0; y < height; y++)
            {
                for (int x = 0; x < width; x++)
                {
                    switch (map [y, x])
                    {
                    case 1:
                        new FloorTile(Stage, x * TileSize, -1 * y * TileSize + height * TileSize - 16);
                        break;

                    case 2:
                        new PolarBear(Stage, x * TileSize, -1 * y * TileSize + height * TileSize);
                        break;

                    case 3:
                        new Hydrant(Stage, x * TileSize, -1 * y * TileSize + height * TileSize);
                        break;

                    case 4:
                        new FoodItem(Stage, x * TileSize, -1 * y * TileSize + height * TileSize, x + y);
                        break;
                    }
                }
            }

            // Call the base class initializer
            base.InitializeScene();
        }
Ejemplo n.º 3
0
        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 ();
        }
Ejemplo n.º 4
0
 public SpriteObject(RenderSet render_set, SpriteObject relative_to, double x, double y, Texture texture) :
     this(render_set, x, y, texture)
 {
     Corner = new Vector3d(relative_to.CornerX + x, relative_to.CornerY + y, relative_to.PositionZ);;
 }