Ejemplo n.º 1
0
        //reset some events upon player death
        public static void Reset()
        {
            elapsedEventsDuration = 0;
            happening             = Events.none;
            if (eventAlreadyHappened[(int)Events.keySpawns1_tutorial3] && !eventAlreadyHappened[(int)Events.key1Collected_tutorial3])
            {
                CollectablesManager.collectablesRoomManagers[(int)RoomsManager.Rooms.tutorial3].RemoveCollectablesFromMap();
                eventAlreadyHappened[(int)Events.keySpawns1_tutorial3] = false;
            }
            else if (eventAlreadyHappened[(int)Events.keySpawns2_tutorial3] && !eventAlreadyHappened[(int)Events.key2Collected_tutorial3])
            {
                CollectablesManager.collectablesRoomManagers[(int)RoomsManager.Rooms.tutorial3].RemoveCollectablesFromMap();
                eventAlreadyHappened[(int)Events.keySpawns2_tutorial3] = false;
            }
            else if (eventAlreadyHappened[(int)Events.keyAndPowerUpSpawn_midBoss] &&
                     !eventAlreadyHappened[(int)Events.pUpCollected_midBoss])
            {
                CollectablesManager.collectablesRoomManagers[(int)RoomsManager.Rooms.midBoss].AddCollectableToMap(
                    new Collectable(new Point(280, 140), Collectable.ItemType.wallJump_powerup));
            }
            else if (eventAlreadyHappened[(int)Events.spawnKey_altar] &&
                     !eventAlreadyHappened[(int)Events.keyCollected_altar])
            {
                CollectablesManager.collectablesRoomManagers[(int)RoomsManager.Rooms.churchAltarRoom].AddCollectableToMap(
                    new Collectable(new Point(230, 400), Collectable.ItemType.silverKey));
            }
            else if (FinalBoss.Dead)
            {
                List <int[]> tilesToRemove = new List <int[]>();
                for (int col = 1; col < (MapsManager.maps[(int)RoomsManager.Rooms.finalBoss].roomWidthTiles + 1) / 2; col++)
                {
                    tilesToRemove.Add(new int[2] {
                        57, col
                    });
                    tilesToRemove.Add(new int[2] {
                        57, MapsManager.maps[(int)RoomsManager.Rooms.finalBoss].roomWidthTiles - col - 1
                    });
                    tilesToRemove.Add(new int[2] {
                        56, col
                    });
                    tilesToRemove.Add(new int[2] {
                        56, MapsManager.maps[(int)RoomsManager.Rooms.finalBoss].roomWidthTiles - col - 1
                    });
                }
                MapsManager.maps[(int)RoomsManager.Rooms.finalBoss].RemoveGroupOfTiles(tilesToRemove, 0, 100);
            }
            switch (RoomsManager.CurrentRoom)
            {
            case RoomsManager.Rooms.finalBoss:
                if (!FinalBoss.Dead)
                {
                    eventAlreadyHappened[(int)Events.terrainCollapseFinalBoss]   = false;
                    eventAlreadyHappened[(int)Events.finalBossComesAlive]        = false;
                    eventAlreadyHappened[(int)Events.activatePlatformsFinalBoss] = false;
                    eventAlreadyHappened[(int)Events.escapeFinalBossRoom]        = false;
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].Reset();
                    MapsManager.resetMap(RoomsManager.CurrentRoom);
                    FinalBoss.Reset();
                }
                break;

            case RoomsManager.Rooms.escape0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.finalBoss)
                {
                    eventAlreadyHappened[(int)Events.lavaEruption1_escape0] = false;
                    eventAlreadyHappened[(int)Events.lowerFloor1_escape0]   = false;
                    eventAlreadyHappened[(int)Events.removeFloor1_escape0]  = false;
                    eventAlreadyHappened[(int)Events.lavaEruption2_escape0] = false;
                    eventAlreadyHappened[(int)Events.lavaEruption3_escape0] = false;
                    eventAlreadyHappened[(int)Events.lavaEruption4_escape0] = false;
                    eventAlreadyHappened[(int)Events.raiseFloor2_escape0]   = false;
                    eventAlreadyHappened[(int)Events.lavaEruption5_escape0] = false;
                    eventAlreadyHappened[(int)Events.raiseFloor3_escape0]   = false;
                    eventAlreadyHappened[(int)Events.lavaEruption6_escape0] = false;
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].Reset();
                    MapsManager.resetMap(RoomsManager.CurrentRoom);
                }
                break;

            case RoomsManager.Rooms.escape1:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.escape0)
                {
                    eventAlreadyHappened[(int)Events.activatePlatform_escape1] = false;
                    eventAlreadyHappened[(int)Events.raiseFloor1_escape1]      = false;
                    eventAlreadyHappened[(int)Events.lavaEruption1_escape1]    = false;
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].Reset();
                }
                break;
            }
        }
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);

#if LEVEL_EDITOR
            MapsManager.Inizialize(Content.Load <Texture2D>("tiles"));
            CameraManager.Inizialize
            (
                new Texture2D[(int)RoomsManager.Rooms.total]
            {
                Content.Load <Texture2D>(@"backgrounds\tutorial0"),
                Content.Load <Texture2D>(@"backgrounds\tutorial1"),
                Content.Load <Texture2D>(@"backgrounds\tutorial2"),
                Content.Load <Texture2D>(@"backgrounds\tutorial3"),
                Content.Load <Texture2D>(@"backgrounds\tutorial4"),
                Content.Load <Texture2D>(@"backgrounds\bellTower0"),
                Content.Load <Texture2D>(@"backgrounds\bellTower1"),
                Content.Load <Texture2D>(@"backgrounds\bellTower2"),
                Content.Load <Texture2D>(@"backgrounds\midBoss"),
                Content.Load <Texture2D>(@"backgrounds\groundFloor"),
                Content.Load <Texture2D>(@"backgrounds\altarRoom"),
                Content.Load <Texture2D>(@"backgrounds\firstFloor"),
                Content.Load <Texture2D>(@"backgrounds\secondFloor"),
                Content.Load <Texture2D>(@"backgrounds\descent"),
                Content.Load <Texture2D>(@"backgrounds\finalBoss"),
                Content.Load <Texture2D>(@"backgrounds\escape0"),
                Content.Load <Texture2D>(@"backgrounds\escape1"),
                Content.Load <Texture2D>(@"backgrounds\escape2"),
            }
            );
            spriteFont = Content.Load <SpriteFont>(@"fonts\monologue");
            PlatformsManager.Inizialize(Content.Load <Texture2D>("platforms"));
            levelEditor = new LevelEditor(Content.Load <SpriteFont>(@"fonts\arial32"),
                                          Content.Load <SpriteFont>(@"fonts\arial14"),
                                          Content.Load <Texture2D>("whiteTile"));
#else
            //load the game assets here
            currentGameState = GameStates.titleScreen;
            LoadSaveManager.Inizialize();
            GameStats.Inizialize();
            Achievements.Initialize(Content.Load <SpriteFont>(@"fonts\monologue"),
                                    Content.Load <SpriteFont>(@"fonts\LiberationMono12"));
            MapsManager.Inizialize(Content.Load <Texture2D>("tiles"));
            CameraManager.Inizialize
            (
                new Texture2D[(int)RoomsManager.Rooms.total]
            {
                Content.Load <Texture2D>(@"backgrounds\tutorial0"),
                Content.Load <Texture2D>(@"backgrounds\tutorial1"),
                Content.Load <Texture2D>(@"backgrounds\tutorial2"),
                Content.Load <Texture2D>(@"backgrounds\tutorial3"),
                Content.Load <Texture2D>(@"backgrounds\tutorial4"),
                Content.Load <Texture2D>(@"backgrounds\bellTower0"),
                Content.Load <Texture2D>(@"backgrounds\bellTower1"),
                Content.Load <Texture2D>(@"backgrounds\bellTower2"),
                Content.Load <Texture2D>(@"backgrounds\midBoss"),
                Content.Load <Texture2D>(@"backgrounds\groundFloor"),
                Content.Load <Texture2D>(@"backgrounds\altarRoom"),
                Content.Load <Texture2D>(@"backgrounds\firstFloor"),
                Content.Load <Texture2D>(@"backgrounds\secondFloor"),
                Content.Load <Texture2D>(@"backgrounds\descent"),
                Content.Load <Texture2D>(@"backgrounds\finalBoss"),
                Content.Load <Texture2D>(@"backgrounds\escape0"),
                Content.Load <Texture2D>(@"backgrounds\escape1"),
                Content.Load <Texture2D>(@"backgrounds\escape2"),
            }
            );
            PlatformsManager.Inizialize(Content.Load <Texture2D>("platforms"));
            ProjectilesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            Player.Inizialize(Content.Load <Texture2D>(@"characters\player"), new Vector2(16, 185));
            RoomsManager.Inizialize();
            GameEvents.Inizialize();
            FireBallsManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            LavaGeyserManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            EnemyManager.Initialise(Content.Load <Texture2D>(@"characters\enemy1"), Content.Load <Texture2D>(@"characters\enemy2"));
            MidBoss.Initialise(Content.Load <Texture2D>(@"characters\midboss"));
            FinalBoss.Inizialize(Content.Load <Texture2D>(@"characters\finalBoss"),
                                 new Texture2D[] { Content.Load <Texture2D>(@"characters\stoneWing"),
                                                   Content.Load <Texture2D>(@"characters\healthyWing"),
                                                   Content.Load <Texture2D>(@"characters\damagedWing"),
                                                   Content.Load <Texture2D>(@"characters\deadWing") });
            CollectablesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            MonologuesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"),
                                         Content.Load <SpriteFont>(@"fonts\monologue"));
            DoorsManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            AnimatedSpritesManager.Inizialize(Content.Load <Texture2D>("animatedSprites"));
            TorchManager.Initialize(Content.Load <Texture2D>("firePot"));
            PlayerDeathManager.Initialize(Content.Load <Texture2D>(@"menus\deathScreen"),
                                          Content.Load <Texture2D>(@"menus\menuOptions"));
            MenusManager.Initialize(Content.Load <Texture2D>(@"menus\menuOptions"),
                                    new Texture2D[]
            {
                Content.Load <Texture2D>(@"menus\titleScreen"),
                Content.Load <Texture2D>(@"menus\controls"),
                Content.Load <Texture2D>(@"menus\credits"),
                Content.Load <Texture2D>(@"menus\pause"),
                Content.Load <Texture2D>(@"menus\quit"),
                Content.Load <Texture2D>(@"menus\doubleJump"),
                Content.Load <Texture2D>(@"menus\wallJump"),
                Content.Load <Texture2D>(@"menus\achievements"),
            });
            CutscenesManager.Initialize(Content.Load <Texture2D>(@"characters\enemy1"),
                                        Content.Load <Texture2D>(@"characters\player"),
                                        Content.Load <SpriteFont>(@"fonts\monologue"));
            SoundEffects.Initialise
            (
                //Player Sound Effects
                Content.Load <SoundEffect>(@"sounds\pJump"),
                Content.Load <SoundEffect>(@"sounds\pShoot"),
                Content.Load <SoundEffect>(@"sounds\pHurt"),
                Content.Load <SoundEffect>(@"sounds\pickup"),

                //Enemy Sound Effects
                Content.Load <SoundEffect>(@"sounds\enemyAttack"),
                Content.Load <SoundEffect>(@"sounds\enemyHurt"),
                Content.Load <SoundEffect>(@"sounds\e2Attack"),

                //Midboss Sound Effects
                Content.Load <SoundEffect>(@"sounds\midMove"),
                Content.Load <SoundEffect>(@"sounds\midAttack"),
                Content.Load <SoundEffect>(@"sounds\midHurt"),

                Content.Load <SoundEffect>(@"sounds\finAttack"),
                Content.Load <SoundEffect>(@"sounds\finHurt"),
                Content.Load <SoundEffect>(@"sounds\finAwaken"),
                Content.Load <SoundEffect>(@"sounds\finRecover"),
                Content.Load <Song>(@"sounds\finalBossMusic")
            );
            gameInitialized = true;
            Zoom1();
#endif
        }