Ejemplo n.º 1
0
        public KarmaWorld(GraphicsDevice device, ContentManager content)
        {
            KarmaWorld.World = this;

            GraphicsDevice = device;
            ContentManager = content;
            RenderedWorld = new RenderTarget2D(device, device.PresentationParameters.BackBufferWidth, device.PresentationParameters.BackBufferHeight,
                                               true, device.DisplayMode.Format, DepthFormat.Depth24);

            Timers = new Utilities.TimerManager();
            Input = new ButtonInputManager();

            Input.AddInput("Zoom In", new ComboButton(new KeyboardButton(Keys.LeftControl, false), new KeyboardButton(Keys.PageUp, true)));
            Input.AddInput("Zoom Out", new ComboButton(new KeyboardButton(Keys.LeftControl, false), new KeyboardButton(Keys.PageDown, true)));

            CurrentTime = new GameTime(TimeSpan.Zero, TimeSpan.Zero);

            currentZoom = ZoomLevels.Three;

            Camera = new KarmaCamera(device);
            Camera.Zoom = GetCameraZoom(currentZoom);

            CurrentZoom = currentZoom;
            ZoomingIn = false;
            ZoomingOut = false;
            foreach (ZoomLevels zooms in WorldData.AscendingZooms)
                if (WorldData.Minigames[zooms] != null)
                    WorldData.Minigames[zooms].ResetGame();

            JoustingInput.InitializeInput();

            Camera.Update(new GameTime(TimeSpan.FromSeconds(0.016667), TimeSpan.FromSeconds(0.016667)));
            Camera.Zoom = GetCameraZoom(currentZoom);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// LoadContent will be called once per game and is the place to load
        /// all of your content.
        /// </summary>
        protected override void LoadContent()
        {
            // Create a new SpriteBatch, which can be used to draw textures.
            spriteBatch = new SpriteBatch(GraphicsDevice);

            Utilities.Graphics.TexturePrimitiveDrawer.MakeBlankDrawingTex(GraphicsDevice);
            WorldData.Initialize(GraphicsDevice);
            ArtAssets.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_1.ArtAssets1.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_2.ArtAssets2.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_3.ArtAssets3.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_4.ArtAssets4.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_5.ArtAssets5.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_1.SoundAssets1.Initialize(Content);
            Minigames.Minigame_2.SoundAssets2.Initialize(Content);
            Minigames.Minigame_3.SoundAssets3.Initialize(Content);
            Minigames.Minigame_4.SoundAssets4.Initialize(Content);
            Minigames.Minigame_5.SoundAssets5.Initialize(Content);
            Minigames.Minigame_1.ParticleAssets1.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_3.ParticleAssets3.Initialize(GraphicsDevice, Content);
            Minigames.Minigame_5.ParticleAssets5.Initialize(GraphicsDevice, Content);

            graphics.PreferredBackBufferWidth = ArtAssets.WorldBackgrounds[ZoomLevels.One].Width;
            graphics.PreferredBackBufferHeight = ArtAssets.WorldBackgrounds[ZoomLevels.One].Height;
            Utilities.OtherFunctions.SetWindowCoords(new Point(0, 0), this, graphics);
            graphics.ApplyChanges();

            Utilities.OtherFunctions.SetWindowCoords(new Point(0, 0), this, graphics);

            world = new KarmaWorld(GraphicsDevice, Content);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Allows the game to run logic such as updating the world,
        /// checking for collisions, gathering input, and playing audio.
        /// </summary>
        /// <param name="gameTime">Provides a snapshot of timing values.</param>
        protected override void Update(GameTime gameTime)
        {
            if (current != States.Playing)
            {
                world.KS = Keyboard.GetState();
            }

            switch (current)
            {
                case States.Playing:
                    world.Update(gameTime);
                    if (world.KS.IsKeyDown(Keys.Escape))
                    {
                        if (!buttonDown)
                        {
                            current = States.Paused;
                            buttonDown = true;
                        }
                    }
                    else buttonDown = false;
                    if (world.HarmonyWon) current = States.HarmonyWin;
                    else if (world.DiscordWon) current = States.DiscordWin;

                    break;
                case States.Paused:
                    if (world.KS.IsKeyDown(Keys.Escape))
                    {
                        if (!buttonDown)
                        {
                            current = States.Playing;
                            buttonDown = true;
                        }
                    }
                    else buttonDown = false;
                    break;
                case States.MainMenu:
                    if (world.KS.IsKeyDown(Keys.Enter))
                    {
                        if (!buttonDown)
                        {
                            world = new KarmaWorld(GraphicsDevice, Content);
                            current = States.Playing;
                            buttonDown = true;
                        }
                    }
                    else if (world.KS.IsKeyDown(Keys.Escape))
                    {
                        if (!buttonDown)
                        {
                            Exit();
                            buttonDown = true;
                        }
                    }
                    else if (world.KS.IsKeyDown(Keys.Space))
                    {
                        if (!buttonDown)
                        {
                            current = States.Instructions;
                            buttonDown = true;
                        }
                    }
                    else buttonDown = false;
                    break;
                case States.Instructions:
                    if (world.KS.IsKeyDown(Keys.Escape))
                    {
                        if (!buttonDown)
                        {
                            current = States.MainMenu;
                            buttonDown = true;
                        }
                    }
                    else buttonDown = false;
                    break;
                case States.HarmonyWin:
                    if (world.KS.IsKeyDown(Keys.Enter))
                    {
                        if (!buttonDown)
                        {
                            current = States.MainMenu;
                            buttonDown = true;
                        }
                    }
                    else buttonDown = false;
                    break;
                case States.DiscordWin:
                    if (world.KS.IsKeyDown(Keys.Enter))
                    {
                        if (!buttonDown)
                        {
                            current = States.MainMenu;
                            buttonDown = true;
                        }
                    }
                    else buttonDown = false;
                    break;

                default: throw new NotImplementedException();
            }

            base.Update(gameTime);
        }