Esempio n. 1
0
 public static void Update(float elapsedTime)
 {
     if (switchRoom())
         LoadSaveManager.SaveGameProgress();
     CameraManager.Update(elapsedTime);
     MapsManager.maps[(int)currentRoom].Update(elapsedTime);
     if (currentRoom== Rooms.finalBoss)
     {
         FinalBoss.Update(elapsedTime);
     }
     if(currentRoom==Rooms.midBoss)
     {
        MidBoss.Update(elapsedTime);
     }
     EnemyManager.enemyRoomManagers[(int)currentRoom].Update(elapsedTime);
     FireBallsManager.Update(elapsedTime);
     LavaGeyserManager.Update(elapsedTime);
     PlatformsManager.platformsRoomManagers[(int)currentRoom].Update(elapsedTime);
     CollectablesManager.collectablesRoomManagers[(int)currentRoom].Update(elapsedTime);
     MonologuesManager.monologuesRoomManagers[(int)currentRoom].Update(elapsedTime);
     DoorsManager.doorsRoomManagers[(int)currentRoom].Update();
     AnimatedSpritesManager.animatedSpritesRoomManagers[(int)currentRoom].Update(elapsedTime);
     TorchManager.Update(elapsedTime);
 }
Esempio n. 2
0
 public static void Draw(SpriteBatch spriteBatch)
 {
     AnimatedSpritesManager.animatedSpritesRoomManagers[(int)currentRoom].DrawOnTheBack(spriteBatch);
     TorchManager.Draw(spriteBatch);
     PlatformsManager.platformsRoomManagers[(int)currentRoom].Draw(spriteBatch);
     if (currentRoom == Rooms.finalBoss)
     {
         FinalBoss.Draw(spriteBatch);
     }
     else if (currentRoom == Rooms.midBoss)
     {
         MidBoss.Draw(spriteBatch);
     }
     EnemyManager.enemyRoomManagers[(int)currentRoom].Draw(spriteBatch);
     CollectablesManager.collectablesRoomManagers[(int)currentRoom].Draw(spriteBatch);
     ProjectilesManager.Draw(spriteBatch);
     Player.Draw(spriteBatch);
     MapsManager.maps[(int)currentRoom].Draw(spriteBatch);
     DoorsManager.doorsRoomManagers[(int)currentRoom].Draw(spriteBatch);
     AnimatedSpritesManager.animatedSpritesRoomManagers[(int)currentRoom].DrawInFront(spriteBatch);
     FireBallsManager.Draw(spriteBatch);
     LavaGeyserManager.Draw(spriteBatch);
     MonologuesManager.monologuesRoomManagers[(int)currentRoom].Draw(spriteBatch);
 }
Esempio n. 3
0
        //state machine managing the movement between rooms
        static bool switchRoom()
        {
            switch (currentRoom)
            {
                case Rooms.tutorial0:
                    if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to tutorial1
                        currentRoom = Rooms.tutorial1;
                        previousRoom = Rooms.tutorial0;
                        CameraManager.SwitchCamera(Rooms.tutorial1);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to tutorial4
                        currentRoom = Rooms.tutorial4;
                        previousRoom = Rooms.tutorial0;
                        CameraManager.SwitchCamera(Rooms.tutorial4);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial1:
                    if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to tutorial2
                        currentRoom = Rooms.tutorial2;
                        previousRoom = Rooms.tutorial1;
                        CameraManager.SwitchCamera(Rooms.tutorial2);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X + Player.width < 0)
                    {//move to tutorial0
                        currentRoom = Rooms.tutorial0;
                        previousRoom = Rooms.tutorial1;
                        CameraManager.SwitchCamera(Rooms.tutorial0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to tutorial3
                        currentRoom = Rooms.tutorial3;
                        previousRoom = Rooms.tutorial1;
                        CameraManager.SwitchCamera(Rooms.tutorial3);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial2:
                    if (Player.position.Y+Player.height<0)
                    {
                        if (Player.position.X>= MapsManager.maps[(int)Rooms.tutorial1].RoomWidthtPx)
                        {//move to tutorial3
                            currentRoom = Rooms.tutorial3;
                            previousRoom = Rooms.tutorial2;
                            CameraManager.SwitchCamera(Rooms.tutorial3);
                            Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                            Player.position.X -= MapsManager.maps[(int)Rooms.tutorial1].RoomWidthtPx;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                        else
                        {//move to tutorial1
                            currentRoom = Rooms.tutorial1;
                            previousRoom = Rooms.tutorial2;
                            CameraManager.SwitchCamera(Rooms.tutorial1);
                            Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                    }
                    else if (Player.position.X+Player.width<0)
                    {//moveto tutorial4
                        currentRoom = Rooms.tutorial4;
                        previousRoom = Rooms.tutorial2;
                        CameraManager.SwitchCamera(Rooms.tutorial4);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial3:
                    if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to tutorial2
                        currentRoom = Rooms.tutorial2;
                        previousRoom = Rooms.tutorial3;
                        CameraManager.SwitchCamera(Rooms.tutorial2);
                        Player.position.X += MapsManager.maps[(int)Rooms.tutorial1].RoomWidthtPx;
                        Player.position.Y = -10;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X<0)
                    {//move to tutorial1
                        currentRoom = Rooms.tutorial1;
                        previousRoom = Rooms.tutorial3;
                        CameraManager.SwitchCamera(Rooms.tutorial1);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx-Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.tutorial3;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.X = 0;
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx- MapsManager.maps[(int)Rooms.tutorial3].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.tutorial4:
                    if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to tutorial2
                        currentRoom = Rooms.tutorial2;
                        previousRoom = Rooms.tutorial4;
                        CameraManager.SwitchCamera(Rooms.tutorial2);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y+Player.height<0)
                    {//move to tutorial0
                        currentRoom = Rooms.tutorial0;
                        previousRoom = Rooms.tutorial4;
                        CameraManager.SwitchCamera(Rooms.tutorial0);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to escape2
                        currentRoom = Rooms.escape2;
                        previousRoom = Rooms.tutorial4;
                        CameraManager.SwitchCamera(Rooms.escape2);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchBellTower0:
                    if (Player.position.X+Player.width<0)
                    {//move to tutorial3
                        currentRoom = Rooms.tutorial3;
                        previousRoom = Rooms.churchBellTower0;
                        CameraManager.SwitchCamera(Rooms.tutorial3);
                        Player.position.X= MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y+Player.height<0)
                    {//move up to churchBellTower1
                        currentRoom = Rooms.churchBellTower1;
                        previousRoom = Rooms.churchBellTower0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower1);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {
                        if (Player.position.Y> 496)
                        {//move to churchGroundFloor0
                            currentRoom = Rooms.churchGroundFloor0;
                            previousRoom = Rooms.churchBellTower0;
                            CameraManager.SwitchCamera(Rooms.churchGroundFloor0);
                            Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                            Player.position.X = 0;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                        else if (Player.position.Y>248)
                        {//church1stFloor0
                            currentRoom = Rooms.church1stFloor0;
                            previousRoom = Rooms.churchBellTower0;
                            CameraManager.SwitchCamera(Rooms.church1stFloor0);
                            Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx + MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                            Player.position.X = 0;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }
                        else
                        {//church2ndFloor0
                            currentRoom = Rooms.church2ndFloor0;
                            previousRoom = Rooms.churchBellTower0;
                            CameraManager.SwitchCamera(Rooms.church2ndFloor0);
                            Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx
                                                 + MapsManager.maps[(int)Rooms.church1stFloor0].RoomHeightPx
                                                 + MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx
                                                 - MapsManager.maps[(int)Rooms.churchBellTower0].RoomHeightPx;
                            Player.position.X = 0;
                            FireBallsManager.Reset();
                            LavaGeyserManager.Reset();
                            ProjectilesManager.Reset();
                            return true;
                        }

                    }
                    break;
                case Rooms.churchBellTower1:
                    if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move down to chirchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.churchBellTower1;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y + Player.height < 0)
                    {//move up to chirchBellTower2
                        currentRoom = Rooms.churchBellTower2;
                        previousRoom = Rooms.churchBellTower1;
                        CameraManager.SwitchCamera(Rooms.churchBellTower2);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchBellTower2:
                    if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move down to chirchBellTower1
                        currentRoom = Rooms.churchBellTower1;
                        previousRoom = Rooms.churchBellTower2;
                        CameraManager.SwitchCamera(Rooms.churchBellTower1);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y + Player.height < 0)
                    {//move up to midBoss
                        currentRoom = Rooms.midBoss;
                        previousRoom = Rooms.churchBellTower2;
                        CameraManager.SwitchCamera(Rooms.midBoss);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.midBoss:
                    if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move down to chirchBellTower1
                        currentRoom = Rooms.churchBellTower2;
                        previousRoom = Rooms.midBoss;
                        CameraManager.SwitchCamera(Rooms.churchBellTower2);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchGroundFloor0:
                    if (Player.position.X+Player.width<0)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.churchGroundFloor0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx - MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to churchAltarRoom
                        currentRoom = Rooms.churchAltarRoom;
                        previousRoom = Rooms.churchGroundFloor0;
                        CameraManager.SwitchCamera(Rooms.churchAltarRoom);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.churchAltarRoom:
                    if (Player.position.X+Player.width<0)
                    {//move to churchGroundFloor0
                        currentRoom = Rooms.churchGroundFloor0;
                        previousRoom = Rooms.churchAltarRoom;
                        CameraManager.SwitchCamera(Rooms.churchGroundFloor0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y+Player.height<0)
                    {//move to church1stFloor0
                        currentRoom = Rooms.church1stFloor0;
                        previousRoom = Rooms.churchAltarRoom;
                        CameraManager.SwitchCamera(Rooms.church1stFloor0);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        Player.position.X += MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to descent
                        currentRoom = Rooms.descent;
                        previousRoom = Rooms.churchAltarRoom;
                        CameraManager.SwitchCamera(Rooms.descent);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.church1stFloor0:
                    if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to churchAltarRoom
                        currentRoom = Rooms.churchAltarRoom;
                        previousRoom = Rooms.church1stFloor0;
                        CameraManager.SwitchCamera(Rooms.churchAltarRoom);
                        Player.position.Y = 0;
                        Player.position.X -= MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y +Player.height <0)
                    {//move to church2ndFloor0
                        currentRoom = Rooms.church2ndFloor0;
                        previousRoom = Rooms.church1stFloor0;
                        CameraManager.SwitchCamera(Rooms.church2ndFloor0);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X+Player.width<0)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.church1stFloor0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.church1stFloor0].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx;
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx-Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.church2ndFloor0:
                    if (Player.position.X+Player.width<0)
                    {//move to churchBellTower0
                        currentRoom = Rooms.churchBellTower0;
                        previousRoom = Rooms.church2ndFloor0;
                        CameraManager.SwitchCamera(Rooms.churchBellTower0);
                        Player.position.Y += MapsManager.maps[(int)currentRoom].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.church1stFloor0].RoomHeightPx
                                             - MapsManager.maps[(int)Rooms.churchGroundFloor0].RoomHeightPx
                                             -MapsManager.maps[(int)Rooms.church2ndFloor0].RoomHeightPx;
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to church1stFloor0
                        currentRoom = Rooms.church1stFloor0;
                        previousRoom = Rooms.church2ndFloor0;
                        CameraManager.SwitchCamera(Rooms.church1stFloor0);
                        Player.position.Y = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.descent:
                    if (Player.position.Y+Player.height<0)
                    {//move to churchAltarRoom
                        currentRoom = Rooms.churchAltarRoom;
                        previousRoom = Rooms.descent;
                        CameraManager.SwitchCamera(Rooms.churchAltarRoom);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {//move to finalBoss
                        currentRoom = Rooms.finalBoss;
                        previousRoom = Rooms.descent;
                        Game1.Zoom0Dot5();
                        CameraManager.SwitchCamera(Rooms.finalBoss);
                        Player.position.Y = 0;
                        Player.position.X += MapsManager.maps[(int)currentRoom].RoomWidthtPx - MapsManager.maps[(int)Rooms.descent].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    break;
                case Rooms.finalBoss:
                    if (Player.position.X+Player.width<0)
                    {//move to escape0
                        currentRoom = Rooms.escape0;
                        previousRoom = Rooms.finalBoss;
                        Game1.Zoom1();
                        CameraManager.SwitchCamera(Rooms.escape0);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx-Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if(Player.position.Y+Player.height<0) 
                    {//move to descent
                        currentRoom = Rooms.descent;
                        previousRoom = Rooms.finalBoss;
                        Game1.Zoom1();
                        CameraManager.SwitchCamera(Rooms.descent);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx - Player.height;
                        Player.position.X += MapsManager.maps[(int)currentRoom].RoomWidthtPx - MapsManager.maps[(int)Rooms.finalBoss].RoomWidthtPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y> MapsManager.maps[(int)currentRoom].RoomHeightPx)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
                case Rooms.escape0:
                    if (Player.position.X > MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to finalBoss
                        currentRoom = Rooms.finalBoss;
                        previousRoom = Rooms.escape0;
                        Game1.Zoom0Dot5();
                        CameraManager.SwitchCamera(Rooms.finalBoss);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X + Player.width<0)
                    {//move to escape1
                        currentRoom = Rooms.escape1;
                        previousRoom = Rooms.escape0;
                        CameraManager.SwitchCamera(Rooms.escape1);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        Player.position.Y += MapsManager.maps[(int)Rooms.descent].RoomHeightPx - MapsManager.maps[(int)Rooms.tutorial2].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx + 24)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
                case Rooms.escape1:
                    if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to escape0
                        currentRoom = Rooms.escape0;
                        previousRoom = Rooms.escape1;
                        CameraManager.SwitchCamera(Rooms.escape0);
                        Player.position.X = 0;
                        Player.position.Y-= MapsManager.maps[(int)Rooms.descent].RoomHeightPx - MapsManager.maps[(int)Rooms.tutorial2].RoomHeightPx;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.X+Player.width<0)
                    {//move to escape2
                        currentRoom = Rooms.escape2;
                        previousRoom = Rooms.escape1;
                        CameraManager.SwitchCamera(Rooms.escape2);
                        Player.position.X = MapsManager.maps[(int)currentRoom].RoomWidthtPx - Player.width;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx + 24)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
                case Rooms.escape2:
                    if (Player.position.X> MapsManager.maps[(int)currentRoom].RoomWidthtPx)
                    {//move to escape1
                        currentRoom = Rooms.escape1;
                        previousRoom = Rooms.escape2;
                        CameraManager.SwitchCamera(Rooms.escape1);
                        Player.position.X = 0;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if(Player.position.Y+Player.height<0)
                    {//move to tutorial4
                        currentRoom = Rooms.tutorial4;
                        previousRoom = Rooms.escape2;
                        CameraManager.SwitchCamera(Rooms.tutorial4);
                        Player.position.Y = MapsManager.maps[(int)currentRoom].RoomHeightPx-Player.height;
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                        ProjectilesManager.Reset();
                        return true;
                    }
                    else if (Player.position.Y > MapsManager.maps[(int)currentRoom].RoomHeightPx + 24)
                    {
                        Player.takeDamage(Player.maxHealthPoints, true);
                    }
                    break;
            }
            return false;
        }
Esempio n. 4
0
        //trigger the specified event
        public static void TriggerEvent(Events _event)
        {
            if (RoomsManager.CurrentRoom == RoomsManager.Rooms.tutorial0)
            {
                switch (_event)
                {
                case Events.introMonologue:
                    MonologuesManager.monologuesRoomManagers[(int)RoomsManager.CurrentRoom].PlayMonologue(0);
                    happening             = Events.introMonologue;
                    elapsedEventsDuration = 0;
                    break;

                case Events.finalMonologue:
                    MonologuesManager.monologuesRoomManagers[(int)RoomsManager.CurrentRoom].PlayMonologue(1);
                    happening             = Events.finalMonologue;
                    elapsedEventsDuration = 0;
                    break;

                case Events.finalCutscene:
                    Game1.currentGameState = Game1.GameStates.ending;
                    CutscenesManager.cutscenes[1].ChangeSentence
                        (CutscenesManager.cutscenes[1].GetNUmOfSentences() - 1, "Your Time: " + GameStats.GetTimeString() +
                        "                                                                                            ");
                    happening             = Events.finalCutscene;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.tutorial3)
            {
                switch (_event)
                {
                case Events.keySpawns1_tutorial3:
                    CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                        new Collectable(new Point(350, 132), Collectable.ItemType.brassKey));
                    happening             = Events.keySpawns1_tutorial3;
                    elapsedEventsDuration = 0;
                    break;

                case Events.key1Collected_tutorial3:
                    eventAlreadyHappened[(int)Events.key1Collected_tutorial3] = true;
                    break;

                case Events.keySpawns2_tutorial3:
                    CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                        new Collectable(new Point(350, 46), Collectable.ItemType.silverKey));
                    happening             = Events.keySpawns2_tutorial3;
                    elapsedEventsDuration = 0;
                    break;

                case Events.key2Collected_tutorial3:
                    eventAlreadyHappened[(int)Events.key2Collected_tutorial3] = true;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.churchBellTower0)
            {
                switch (_event)
                {
                case Events.unlockDoubleJump:
                    Player.doubleJumpUnlocked = true;
                    AnimatedSpritesManager.animatedSpritesRoomManagers[(int)RoomsManager.CurrentRoom].AddTempAnimatedSprite(
                        new AnimatedSprite(new Vector2(211, 926), AnimatedSprite.AnimationType.displayDoubleJumpRelic, false));
                    happening             = Events.unlockDoubleJump;
                    elapsedEventsDuration = 0;
                    break;

                case Events.showDoubleJumpScreen:
                    Game1.currentGameState = Game1.GameStates.doubleJump;
                    happening             = Events.showDoubleJumpScreen;
                    elapsedEventsDuration = 0;
                    break;

                case Events.unlockWallJump:
                    Player.wallJumpUnlocked = true;
                    AnimatedSpritesManager.animatedSpritesRoomManagers[(int)RoomsManager.CurrentRoom].AddTempAnimatedSprite(
                        new AnimatedSprite(new Vector2(239, 926), AnimatedSprite.AnimationType.displayWallJumpRelic, false));
                    happening             = Events.unlockWallJump;
                    elapsedEventsDuration = 0;
                    break;

                case Events.showWallJumpScreen:
                    Game1.currentGameState = Game1.GameStates.wallJump;
                    happening             = Events.showWallJumpScreen;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.midBoss)
            {
                switch (_event)
                {
                case Events.keyAndPowerUpSpawn_midBoss:
                    CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                        new Collectable(new Point(280, 140), Collectable.ItemType.wallJump_powerup));
                    CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                        new Collectable(new Point(216, 148), Collectable.ItemType.brassKey));
                    happening             = Events.keyAndPowerUpSpawn_midBoss;
                    elapsedEventsDuration = 0;
                    break;

                case Events.pUpCollected_midBoss:
                    eventAlreadyHappened[(int)Events.pUpCollected_midBoss] = true;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.churchGroundFloor0)
            {
                switch (_event)
                {
                case Events.activateMovingPlatforms_churchGroundFloor0:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[16].active = true;
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[17].active = true;
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[18].active = true;
                    happening = Events.activateMovingPlatforms_churchGroundFloor0;
                    eventAlreadyHappened[(int)Events.resetMovingPlatforms_churchGroundFloor0] = false;
                    elapsedEventsDuration = 0;
                    break;

                case Events.resetMovingPlatforms_churchGroundFloor0:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[16].Reset(false);
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[17].Reset(false);
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[18].Reset(false);
                    happening = Events.resetMovingPlatforms_churchGroundFloor0;
                    eventAlreadyHappened[(int)Events.activateMovingPlatforms_churchGroundFloor0] = false;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.church1stFloor0)
            {
                switch (_event)
                {
                case Events.showInvisibleTiles_church1stFloor0:
                    List <AnimatedSprite> animatedSprites = new List <AnimatedSprite>();
                    for (int row = 0; row < MapsManager.maps[(int)RoomsManager.CurrentRoom].roomHeightTiles; row++)
                    {
                        for (int col = 0; col < MapsManager.maps[(int)RoomsManager.CurrentRoom].roomWidthTiles; col++)
                        {
                            if (MapsManager.maps[(int)RoomsManager.CurrentRoom].array[row, col].tileType == Tile.TileType.solidEmpty)
                            {
                                animatedSprites.Add(new AnimatedSprite(new Vector2(col * Tile.tileSize, row * Tile.tileSize),
                                                                       AnimatedSprite.AnimationType.invisibleTile));
                            }
                        }
                    }
                    AnimatedSpritesManager.animatedSpritesRoomManagers[(int)RoomsManager.CurrentRoom].AddAnimatedSprites(animatedSprites);
                    if (Player.position.X < 1032 && Player.position.X >= 1000)
                    {
                        CameraManager.MoveCamera(0, new Vector2(856, MapsManager.maps[(int)RoomsManager.CurrentRoom].RoomHeightPx), 8);
                    }
                    else if (Player.position.X < 684 && Player.position.X >= 664)
                    {
                        CameraManager.MoveCamera(0, new Vector2(528, MapsManager.maps[(int)RoomsManager.CurrentRoom].RoomHeightPx), 8);
                    }
                    else if (Player.position.X < 364 && Player.position.X >= 344)
                    {
                        CameraManager.MoveCamera(0, new Vector2(204, MapsManager.maps[(int)RoomsManager.CurrentRoom].RoomHeightPx), 8);
                    }
                    happening = Events.showInvisibleTiles_church1stFloor0;
                    eventAlreadyHappened[(int)Events.hide_InvisibleTiles_church1stFloor0] = false;
                    elapsedEventsDuration = 0;
                    break;

                case Events.hide_InvisibleTiles_church1stFloor0:
                    AnimatedSpritesManager.animatedSpritesRoomManagers[(int)RoomsManager.CurrentRoom].ClearAnimatedSprites();
                    CameraManager.MoveCamera(1, CameraManager.pointLocked, 8);
                    happening = Events.hide_InvisibleTiles_church1stFloor0;
                    eventAlreadyHappened[(int)Events.showInvisibleTiles_church1stFloor0] = false;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.churchAltarRoom)
            {
                switch (_event)
                {
                case Events.spawnKey_altar:
                    CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                        new Collectable(new Point(230, 400), Collectable.ItemType.silverKey));
                    eventAlreadyHappened[(int)Events.spawnKey_altar] = true;
                    break;

                case Events.keyCollected_altar:
                    eventAlreadyHappened[(int)Events.keyCollected_altar] = true;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.finalBoss)
            {
                switch (_event)
                {
                case Events.terrainCollapseFinalBoss:
                    List <int[]> tilesToRemove = new List <int[]>();
                    for (int col = 1; col < (MapsManager.maps[(int)RoomsManager.CurrentRoom].roomWidthTiles + 1) / 2; col++)
                    {
                        tilesToRemove.Add(new int[2] {
                            57, col
                        });
                        tilesToRemove.Add(new int[2] {
                            57, MapsManager.maps[(int)RoomsManager.CurrentRoom].roomWidthTiles - col - 1
                        });
                        tilesToRemove.Add(new int[2] {
                            56, col
                        });
                        tilesToRemove.Add(new int[2] {
                            56, MapsManager.maps[(int)RoomsManager.CurrentRoom].roomWidthTiles - col - 1
                        });
                    }
                    CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].RemoveCollectablesFromMap();
                    CameraManager.shakeForTime(eventsDuration[(int)Events.terrainCollapseFinalBoss]);
                    CameraManager.MoveCamera(0.3f, FinalBoss.fireballsCenter, 1);
                    MapsManager.maps[(int)RoomsManager.CurrentRoom].RemoveGroupOfTiles(tilesToRemove, 0.03f, 3);
                    happening             = Events.terrainCollapseFinalBoss;
                    elapsedEventsDuration = 0;
                    break;

                case Events.finalBossComesAlive:
                    CameraManager.shakeForTime(eventsDuration[(int)Events.finalBossComesAlive]);
                    FinalBoss.WakeUp();
                    happening             = Events.finalBossComesAlive;
                    elapsedEventsDuration = 0;
                    break;

                case Events.activatePlatformsFinalBoss:
                    for (int i = 0; i < 6; i++)
                    {
                        PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[i].active = true;
                    }
                    happening             = Events.activatePlatformsFinalBoss;
                    elapsedEventsDuration = 0;
                    break;

                case Events.escapeFinalBossRoom:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[6].active = true;
                    CameraManager.MoveCamera(1, FinalBoss.fireballsCenter, 1);
                    LavaGeyserManager.SweepAcross(2, 0.7f, 1, 0, 24, false);
                    happening             = Events.escapeFinalBossRoom;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.escape0)
            {
                switch (_event)
                {
                case Events.monologue_escape0:
                    MonologuesManager.monologuesRoomManagers[(int)RoomsManager.CurrentRoom].PlayMonologue(0);
                    happening             = Events.monologue_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lavaEruption1_escape0:
                    LavaGeyserManager.ShootGeyser(new float[] { MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 308 }, 0, -1000);
                    List <int[]> tilesToRemove = new List <int[]>();
                    for (int i = 0; i < 10; i++)
                    {
                        for (int j = 0; j < 3; j++)
                        {
                            tilesToRemove.Add(new int[2] {
                                MapsManager.maps[(int)RoomsManager.Rooms.escape0].roomHeightTiles - i - 1,
                                MapsManager.maps[(int)RoomsManager.Rooms.escape0].roomWidthTiles - 40 + j
                            });
                        }
                    }
                    MapsManager.maps[(int)RoomsManager.CurrentRoom].RemoveGroupOfTiles(tilesToRemove, 0.01f, 3, 0.3f);
                    happening             = Events.lavaEruption1_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lowerFloor1_escape0:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[0].active = true;
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[1].active = true;
                    happening             = Events.lowerFloor1_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.removeFloor1_escape0:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[0].RemovePlatform();
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[1].RemovePlatform();
                    happening             = Events.removeFloor1_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lavaEruption2_escape0:
                    LavaGeyserManager.ShootGeyser(new float[]
                    {
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 664,
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 640
                    }, 0);
                    happening             = Events.lavaEruption2_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lavaEruption3_escape0:
                    LavaGeyserManager.ShootGeyser(new float[]
                    {
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 1032,
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 1008
                    }, 0, -600);
                    happening             = Events.lavaEruption3_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lavaEruption4_escape0:
                    LavaGeyserManager.ShootGeyser(new float[]
                    {
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 972,
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 948
                    }, 0, -600);
                    happening             = Events.lavaEruption4_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.raiseFloor2_escape0:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[2].active = true;
                    happening             = Events.raiseFloor2_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lavaEruption5_escape0:
                    LavaGeyserManager.ShootGeyser(new float[] { MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 1388 }, 1.5f, -800);
                    happening             = Events.lavaEruption5_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.raiseFloor3_escape0:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms[3].active = true;
                    happening             = Events.raiseFloor3_escape0;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lavaEruption6_escape0:
                    LavaGeyserManager.ShootGeyser(new float[]
                    {
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 1688,
                        MapsManager.maps[(int)RoomsManager.Rooms.escape0].RoomWidthtPx - 1664
                    }, 0);
                    happening             = Events.lavaEruption6_escape0;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.escape1)
            {
                switch (_event)
                {
                case Events.activatePlatform_escape1:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.Rooms.escape1].movingPlatforms[0].active = true;
                    happening             = Events.activatePlatform_escape1;
                    elapsedEventsDuration = 0;
                    break;

                case Events.raiseFloor1_escape1:
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.Rooms.escape1].movingPlatforms[1].active = true;
                    PlatformsManager.platformsRoomManagers[(int)RoomsManager.Rooms.escape1].movingPlatforms[2].active = true;
                    happening             = Events.raiseFloor1_escape1;
                    elapsedEventsDuration = 0;
                    break;

                case Events.lavaEruption1_escape1:
                    LavaGeyserManager.SweepAcross(0.2f, 0, 10, 0, 96, true);
                    happening             = Events.lavaEruption1_escape1;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
            else if (RoomsManager.CurrentRoom == RoomsManager.Rooms.escape2)
            {
                switch (_event)
                {
                case Events.lavaEruption_escape2:
                    LavaGeyserManager.ShootGeyser(new float[] { 396 }, 0f);
                    LavaGeyserManager.ShootGeyser(new float[] { 376 }, 0.2f);
                    LavaGeyserManager.ShootGeyser(new float[] { 356 }, 0.4f);
                    LavaGeyserManager.ShootGeyser(new float[] { 336 }, 0.6f);
                    LavaGeyserManager.ShootGeyser(new float[] { 316 }, 0.8f);
                    LavaGeyserManager.ShootGeyser(new float[] { 296 }, 1f);
                    LavaGeyserManager.ShootGeyser(new float[] { 276 }, 1.2f);
                    LavaGeyserManager.ShootGeyser(new float[] { 256 }, 1.4f);
                    LavaGeyserManager.ShootGeyser(new float[] { 236 }, 1.6f);
                    LavaGeyserManager.ShootGeyser(new float[] { 216 }, 1.8f);
                    LavaGeyserManager.ShootGeyser(new float[] { 196 }, 2f);
                    LavaGeyserManager.ShootGeyser(new float[] { 176 }, 2.2f);
                    LavaGeyserManager.ShootGeyser(new float[] { 156 }, 2.4f);
                    LavaGeyserManager.ShootGeyser(new float[] { 136 }, 2.6f);
                    LavaGeyserManager.ShootGeyser(new float[] { 116 }, 2.8f);
                    LavaGeyserManager.ShootGeyser(new float[] { 96 }, 3f);
                    happening             = Events.lavaEruption_escape2;
                    elapsedEventsDuration = 0;
                    break;
                }
            }
        }
Esempio n. 5
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
        }
Esempio n. 6
0
        public static void ResetVariables()
        {//reposition the player and reset some classes to their intial state
            Player.IsOnMovingPlatform = false;
            elapsedTimeBeforeResuming = 0;
            Game1.currentGameState    = Game1.GameStates.playing;
            CameraManager.Reset();
            LavaGeyserManager.Reset();
            FireBallsManager.Reset();
            ProjectilesManager.Reset();
            EnemyManager.Reset();
            if (!MidBoss.Dead)
            {
                MidBoss.Reset();
            }
            CollectablesManager.ResetHearts();
            GameEvents.Reset();
            switch (RoomsManager.CurrentRoom)
            {
            case RoomsManager.Rooms.tutorial0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial4)
                {
                    Player.position = new Vector2(152, 192);
                }
                else if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial1)
                {
                    Player.position = new Vector2(903, 185);
                }
                else
                {
                    Player.position = new Vector2(152, 150);
                }
                break;

            case RoomsManager.Rooms.tutorial1:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial0)
                {
                    Player.position = new Vector2(18, 185);
                }
                else
                {
                    Player.position = new Vector2(550, 193);
                }
                break;

            case RoomsManager.Rooms.tutorial2:
                if (Player.position.Y < 80 && RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial1 &&
                    (Player.position.X < 366 || Player.position.X > 426))
                {
                    RoomsManager.CurrentRoom  = RoomsManager.Rooms.tutorial1;
                    RoomsManager.PreviousRoom = RoomsManager.Rooms.tutorial0;
                    CameraManager.SwitchCamera(RoomsManager.Rooms.tutorial1);
                    Player.position = new Vector2(18, 185);
                }
                else
                {
                    Player.position = new Vector2(388, 153);
                }
                break;

            case RoomsManager.Rooms.tutorial3:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                {
                    Player.position = new Vector2(776, 193);
                }
                else
                {
                    Player.position = new Vector2(91, 193);
                }
                break;

            case RoomsManager.Rooms.tutorial4:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.escape2)
                {
                    Player.position = new Vector2(64, 153);
                }
                else
                {
                    Player.position = new Vector2(166, 153);
                }
                break;

            case RoomsManager.Rooms.churchBellTower0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower1)
                {
                    if (Player.position.X < 436 && Player.position.X >= 60)
                    {
                        Player.position = new Vector2(405, 161);
                    }
                    else if (Player.position.X >= 436)
                    {
                        Player.position = new Vector2(456, 961);
                    }
                    else
                    {
                        Player.position = new Vector2(23, 961);
                    }
                }
                else if (RoomsManager.PreviousRoom == RoomsManager.Rooms.tutorial3)
                {
                    Player.position = new Vector2(23, 961);
                }
                else
                {
                    Player.position = new Vector2(456, 961);
                }
                break;

            case RoomsManager.Rooms.churchBellTower1:
                if (Player.position.X >= 436)
                {
                    Player.position = new Vector2(458, 1097);
                }
                else if (Player.position.X < 60)
                {
                    Player.position = new Vector2(23, 1097);
                }
                else
                {
                    if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                    {
                        Player.position = new Vector2(372, 1097);
                    }
                    else
                    {
                        Player.position = new Vector2(111, 121);
                    }
                }
                break;

            case RoomsManager.Rooms.churchBellTower2:
                if (Player.position.X >= 436 && Player.position.Y > 110)
                {
                    Player.position = new Vector2(464, 1177);
                }
                else if (Player.position.X >= 60)
                {
                    if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower1)
                    {
                        Player.position = new Vector2(119, 1177);
                    }
                    else
                    {
                        Player.position = new Vector2(457, 65);
                    }
                }
                else
                {
                    Player.position = new Vector2(23, 1177);
                }
                break;

            case RoomsManager.Rooms.midBoss:
                Player.position = new Vector2(452, 25);
                break;

            case RoomsManager.Rooms.churchGroundFloor0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                {
                    Player.position = new Vector2(22, 465);
                }
                else
                {
                    Player.position = new Vector2(1160, 465);
                }
                break;

            case RoomsManager.Rooms.churchAltarRoom:
                if (Player.position.X < 104)
                {
                    Player.position = new Vector2(22, 465);
                }
                else
                {
                    Player.position = new Vector2(250, 465);
                }
                break;

            case RoomsManager.Rooms.church1stFloor0:
                if (Player.position.X < 1288)
                {
                    if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchAltarRoom)
                    {
                        Player.position = new Vector2(1208, 217);
                    }
                    else
                    {
                        Player.position = new Vector2(18, 217);
                    }
                }
                else
                {
                    Player.position = new Vector2(1320, 217);
                }
                break;

            case RoomsManager.Rooms.church2ndFloor0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchBellTower0)
                {
                    Player.position = new Vector2(37, 481);
                }
                else
                {
                    Player.position = new Vector2(1289, 481);
                }
                break;

            case RoomsManager.Rooms.descent:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.churchAltarRoom)
                {
                    Player.position = new Vector2(339, 121);
                }
                else
                {
                    Player.position = new Vector2(318, 233);
                }
                break;

            case RoomsManager.Rooms.finalBoss:
                Game1.Zoom0Dot5();
                MediaPlayer.Stop();
                if (!FinalBoss.Dead)
                {
                    Player.position = new Vector2(734, 41);
                }
                else
                {
                    Player.position = new Vector2(17, 41);
                }
                break;

            case RoomsManager.Rooms.escape0:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.finalBoss)
                {
                    Player.position = new Vector2(1726, 129);
                }
                else
                {
                    Player.position = new Vector2(18, 49);
                }
                break;

            case RoomsManager.Rooms.escape1:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.escape0)
                {
                    Player.position = new Vector2(1320, 89);
                }
                else
                {
                    Player.position = new Vector2(12, 289);
                }
                break;

            case RoomsManager.Rooms.escape2:
                if (RoomsManager.PreviousRoom == RoomsManager.Rooms.escape1)
                {
                    Player.position = new Vector2(500, 289);
                }
                else
                {
                    Player.position = new Vector2(21, 129);
                }
                break;
            }
        }
Esempio n. 7
0
        public static void Update(float elapsedTime)
        {
            if (dead || bossAnimation == BossAnimations.stone)
            {
                return; //do not update if boss is dead
            }
            if (bossAnimation != BossAnimations.stone &&
                bossAnimation != BossAnimations.stoneToIdle &&
                bossAnimation != BossAnimations.falling)
            { //oscillatory motion
                bossMidPoint.Y += YSpeed;
                YSpeed         += (bossInitialMidPoint.Y - bossMidPoint.Y) * 0.2f * elapsedTime;
            }
            bossAnimations[(int)bossAnimation].Update(elapsedTime);
            rightWingAnimations[(int)rightWingAnimation].Update(elapsedTime);
            leftWingAnimations[(int)leftWingAnimation].Update(elapsedTime);
            if (!bossAnimations[(int)bossAnimation].Active)
            {//if an animation has stopped playing because the last frame was reached
             //decide what animation should be played next
                if (bossAnimation == BossAnimations.startRecovering)
                {
                    bossAnimation      = BossAnimations.recovering;
                    rightWingAnimation = WingAnimations.flap;
                    leftWingAnimation  = WingAnimations.flap;
                    bossAnimations[(int)bossAnimation].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                }
                else
                {
                    bossAnimation      = BossAnimations.idle;
                    rightWingAnimation = WingAnimations.idle;
                    leftWingAnimation  = WingAnimations.idle;
                    if (rightWingTexture == WingTextures.stone || leftWingTexture == WingTextures.stone)
                    {
                        rightWingTexture = WingTextures.healthy;
                        leftWingTexture  = WingTextures.healthy;
                    }
                    bossAnimations[(int)bossAnimation].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                }
            }
            //finate state machine determing the boss AI
            switch (bossAnimation)
            {
            case BossAnimations.stone:
                break;

            case BossAnimations.stoneToIdle:
                break;

            case BossAnimations.idle:     //if the boss is in th eidle state, then it is ready to attack
                                          //the attacks available depend on the phace of the battle
                                          //the battle progresses to the next phase each time a wing is hit
                if (!bossAnimations[(int)bossAnimation].IsLastFrame())
                {
                    break;
                }
                switch (currentPhase)
                {
                case Phases.one:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(4);
                    if (attack == 0)
                    {
                        FireBallsManager.ThrowAtPlayer((int)MathHelper.Lerp(3, 6, 1 - (float)bossHP / maxBossHp), 2 + (float)rand.NextDouble(), 1f);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        FireBallsManager.ThrowInAllDirections((int)MathHelper.Lerp(3, 7, 1 - (float)bossHP / maxBossHp), FireBall.radialShootingVelocity, (float)(0.5 + rand.NextDouble()));
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 2)
                    {
                        int   num       = (int)MathHelper.Lerp(2, 4, 1 - (float)bossHP / maxBossHp);
                        int[] platforms = new int[num];
                        for (int i = 0; i < num; i++)
                        {
                            int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            while (platforms.Contains(nextPlatform))
                            {
                                nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            }
                            platforms[i] = nextPlatform;
                        }
                        FireBallsManager.TargetPlatform(platforms, 6, 2);
                        FireBallsManager.AddGhostFireball(7);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        FireBallsManager.Sweep((float)(0.4 + 0.2 * rand.NextDouble()), rand.Next(3, 5));
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    SoundEffects.FinalBossAttack.Play();
                    break;
                }

                case Phases.two:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(3);
                    if (attack == 0)
                    {
                        attack = rand.Next(2);
                        if (attack == 0)
                        {
                            FireBallsManager.ThrowAtPlayer((int)MathHelper.Lerp(4, 9, 1 - (float)bossHP / maxBossHp), (float)(3 + rand.NextDouble()), 1f);
                        }
                        else
                        {
                            FireBallsManager.ThrowInAllDirections(6, FireBall.radialShootingVelocity, (float)(1 + rand.NextDouble()));
                        }
                        int   num       = (int)MathHelper.Lerp(2, 4, 1 - (float)bossHP / maxBossHp);
                        int[] platforms = new int[num];
                        for (int i = 0; i < num; i++)
                        {
                            int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            while (platforms.Contains(nextPlatform))
                            {
                                nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            }
                            platforms[i] = nextPlatform;
                        }
                        FireBallsManager.TargetPlatform(platforms, 6, 2);
                        FireBallsManager.AddGhostFireball(7);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        float angle = MathHelper.Lerp(90, 180, 1 - (float)bossHP / maxBossHp);
                        FireBallsManager.TrowWithinCircularSector(
                            (int)(angle / 6),
                            FireBall.radialShootingVelocity * 0.8f,
                            (float)(0.25 + 0.5 * rand.NextDouble()),
                            angle);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        FireBallsManager.RandomSweep((float)(1.0f + 0.2 * rand.NextDouble()), 2, 4);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    SoundEffects.FinalBossAttack.Play();
                    break;
                }

                case Phases.three:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(4);
                    if (attack == 0)
                    {
                        attack = rand.Next(2);
                        if (attack == 0)
                        {
                            int   num       = 2;
                            int[] platforms = new int[num];
                            for (int i = 0; i < num; i++)
                            {
                                int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                                while (platforms.Contains(nextPlatform))
                                {
                                    nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                                }
                                platforms[i] = nextPlatform;
                            }
                            FireBallsManager.TargetPlatform(platforms, 6, 2);
                            FireBallsManager.AddGhostFireball(7);
                        }
                        else
                        {
                            FireBallsManager.ThrowAtPlayer(4, (float)(3 + rand.NextDouble()), 1f);
                        }
                        LavaGeyserManager.ShootGeyser(
                            new float[] { rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200),
                                          rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200), },
                            3);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        int   num       = 3;
                        int[] platforms = new int[num];
                        for (int i = 0; i < num; i++)
                        {
                            int nextPlatform = rand.Next(PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            while (platforms.Contains(nextPlatform))
                            {
                                nextPlatform = (nextPlatform + 1) % (PlatformsManager.platformsRoomManagers[(int)RoomsManager.CurrentRoom].movingPlatforms.Length - 1);
                            }
                            platforms[i] = nextPlatform;
                        }
                        FireBallsManager.TargetPlatform(platforms, 6, 5);
                        FireBallsManager.TrowWithinCircularSector(
                            20,
                            FireBall.radialShootingVelocity * 0.8f,
                            (float)(0.5 + 0.1 * rand.NextDouble()),
                            120);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 2)
                    {
                        FireBallsManager.Spiral(30, 20, MathHelper.Lerp(0.3f, 0.5f, (float)bossHP / maxBossHp), FireBall.radialShootingVelocity * 0.4f);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        LavaGeyserManager.EquallySpaced(LavaGeyser.size * 7, 2, 0);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    SoundEffects.FinalBossAttack.Play();
                    break;
                }

                case Phases.four:
                {
                    if (bossHP <= 0)
                    {
                        bossAnimation = BossAnimations.startRecovering;
                        bossAnimations[(int)BossAnimations.startRecovering].Reset();
                        LavaGeyserManager.Reset();
                        FireBallsManager.Reset();
                        rightWingAnimation = WingAnimations.spread;
                        leftWingAnimation  = WingAnimations.spread;
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        break;
                    }
                    if (FireBallsManager.NumberOfActiveFireballs > 0 || LavaGeyserManager.ActiveLavaGeysers > 0)
                    {
                        break;
                    }
                    int attack = rand.Next(3);
                    if (attack == 0)
                    {
                        FireBallsManager.Sweep((float)(0.4 + 0.2 * rand.NextDouble()), 10);
                        LavaGeyserManager.SweepAcross(
                            1,
                            0.5f,
                            (int)MathHelper.Lerp(4, 10, (float)bossHP / maxBossHp),
                            244,
                            524,
                            rand.Next(2) == 0);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else if (attack == 1)
                    {
                        FireBallsManager.TrowWithinCircularSector(
                            (int)(20),
                            FireBall.radialShootingVelocity * 0.8f,
                            (float)(0.25 + 0.5 * rand.NextDouble()),
                            120);
                        LavaGeyserManager.EquallySpaced(LavaGeyser.size * 6, 2, LavaGeyser.size * 6 * (float)rand.NextDouble());
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }
                    else
                    {
                        LavaGeyserManager.ShootGeyser(
                            new float[] { rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200),
                                          rand.Next((int)fireballsCenter.X - 200, (int)fireballsCenter.X + 200), },
                            3);
                        FireBallsManager.Spiral(30, 20, 0.3f, FireBall.radialShootingVelocity * 0.4f);
                        bossAnimation = BossAnimations.attack;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                    }

                    SoundEffects.FinalBossAttack.Play();
                    break;
                }
                }
                break;

            case BossAnimations.attack:     //the boss is attacking
                elapsedAttackAnimationTime += elapsedTime;
                if (elapsedAttackAnimationTime >= attackAnimationTime)
                {
                    elapsedAttackAnimationTime = 0;
                    bossAnimation = BossAnimations.idle;
                    bossAnimations[(int)BossAnimations.idle].Reset();
                    bossAnimations[(int)BossAnimations.endRecovering].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                }
                break;

            case BossAnimations.startRecovering:
                break;

            case BossAnimations.recovering:     //the boss is recovering and its wings can be hit
            {
                if (bossAnimations[(int)bossAnimation].FrameIndex == 0 &&
                    bossAnimations[(int)bossAnimation].FreviousFrameIndex != 0)
                {
                    SoundEffects.FinalBossRecover.Play();
                }
                else if (bossAnimations[(int)bossAnimation].FrameIndex == 2 &&
                         bossAnimations[(int)bossAnimation].FreviousFrameIndex != 2)
                {
                    SoundEffects.FinalBossAwaken.Play();
                }
                elapsedRecoveryTime += elapsedTime;
                if (elapsedRecoveryTime >= recoveryTime)
                {
                    bossAnimation = BossAnimations.endRecovering;
                    if (rightWingHP > 0)
                    {
                        rightWingAnimation = WingAnimations.withdraw;
                    }
                    else
                    {
                        rightWingAnimation = WingAnimations.withdrawDead;
                    }
                    if (leftWingHP > 0)
                    {
                        leftWingAnimation = WingAnimations.withdraw;
                    }
                    else
                    {
                        leftWingAnimation = WingAnimations.withdrawDead;
                    }
                    bossAnimations[(int)BossAnimations.endRecovering].Reset();
                    rightWingAnimations[(int)rightWingAnimation].Reset();
                    leftWingAnimations[(int)leftWingAnimation].Reset();
                    elapsedRecoveryTime = 0;
                    bossHP = maxBossHp / 2;
                    break;
                }
                switch (currentPhase)
                {
                case Phases.one:
                    if (rightWingHP + leftWingHP == 3)
                    {
                        bossHP = maxBossHp;
                        elapsedRecoveryTime = 0;
                        currentPhase        = Phases.two;
                        bossAnimation       = BossAnimations.endRecovering;
                        if (rightWingHP > 0)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                        }
                        if (leftWingHP > 0)
                        {
                            leftWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            leftWingAnimation = WingAnimations.withdrawDead;
                        }
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        bossAnimations[(int)BossAnimations.endRecovering].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        SoundEffects.FinalBossHurt.Play();
                        FireBallsManager.AddGhostFireball(3);
                    }
                    break;

                case Phases.two:
                    if (rightWingHP + leftWingHP == 2)
                    {
                        bossHP = maxBossHp;
                        elapsedRecoveryTime = 0;
                        currentPhase        = Phases.three;
                        bossAnimation       = BossAnimations.endRecovering;
                        if (rightWingHP > 0)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                        }
                        if (leftWingHP > 0)
                        {
                            leftWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            leftWingAnimation = WingAnimations.withdrawDead;
                        }
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        bossAnimations[(int)BossAnimations.endRecovering].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        SoundEffects.FinalBossHurt.Play();
                        FireBallsManager.ThrowAtPlayer(20, 2, 0.1f);
                        CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                            new Collectable(new Point(374, 475), Collectable.ItemType.heart));
                    }
                    break;

                case Phases.three:
                    if (rightWingHP + leftWingHP == 1)
                    {
                        bossHP = maxBossHp;
                        elapsedRecoveryTime = 0;
                        currentPhase        = Phases.four;
                        bossAnimation       = BossAnimations.endRecovering;
                        if (rightWingHP > 0)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                        }
                        if (leftWingHP > 0)
                        {
                            leftWingAnimation = WingAnimations.withdraw;
                        }
                        else
                        {
                            leftWingAnimation = WingAnimations.withdrawDead;
                        }
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        bossAnimations[(int)BossAnimations.endRecovering].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        SoundEffects.FinalBossHurt.Play();
                        LavaGeyserManager.SweepAcross(1, 0f, 100, 159, 609, true);
                        CollectablesManager.collectablesRoomManagers[(int)RoomsManager.CurrentRoom].AddCollectableToMap(
                            new Collectable(new Point(378, 475), Collectable.ItemType.heart));
                    }
                    break;

                case Phases.four:
                    if (rightWingHP + leftWingHP == 0)
                    {
                        if (Player.CollisionRectangle.Right > bossMidPoint.X)
                        {
                            rightWingAnimation = WingAnimations.withdraw;
                            leftWingAnimation  = WingAnimations.withdrawDead;
                        }
                        else
                        {
                            rightWingAnimation = WingAnimations.withdrawDead;
                            leftWingAnimation  = WingAnimations.withdraw;
                        }
                        bossAnimation = BossAnimations.falling;
                        bossAnimations[(int)BossAnimations.attack].Reset();
                        rightWingAnimations[(int)rightWingAnimation].Reset();
                        leftWingAnimations[(int)leftWingAnimation].Reset();
                        elapsedRecoveryTime = 0;
                        SoundEffects.FinalBossHurt.Play();
                        FireBallsManager.Reset();
                        LavaGeyserManager.Reset();
                    }
                    break;
                }
                break;
            }

            case BossAnimations.endRecovering:
                break;

            case BossAnimations.falling:     //when the boss dies, it falls out of the screen
            {
                bossMidPoint.Y += YSpeed * elapsedTime;
                YSpeed         += Gravity.gravityAcceleration * elapsedTime;
                if (BossDrawRectangle.Y > MapsManager.maps[(int)RoomsManager.CurrentRoom].RoomHeightPx)
                {
                    dead = true;
                    LoadSaveManager.SaveGameProgress();
                    MediaPlayer.Stop();
                }
                break;
            }
            }
        }