Exemplo n.º 1
0
        public static void Initialize(SaveGame saveGame = null)
        {
            riotGuardTexture = TextureManager.Get(RIOTGUARD_TEXTURE_NAME);
            drillingEmitter = LineEmitter.getPrebuiltEmitter(PrebuiltLineEmitter.RiotGuardWallDrillSparks);

            farthestLevelX = (saveGame != null) ? saveGame.levelX : LevelManager.STARTING_LEVEL.X;
            wallPos = new Vector2((farthestLevelX - 0.5f) * Level.TEX_SIZE, 0);
            if(saveGame != null) farthestLevelX++; //automatically chase after reloading
            int heroY = (int)RetroGame.getHeroes()[0].position.Y;
            mode = (saveGame != null) ? RiotGuardMode.Moving : RiotGuardMode.Waiting;
            drillingTime = 0;

            heroCoverageArea = new Rectangle[RetroGame.NUM_PLAYERS];

            guardOffsets = new RiotGuardOffset[GUARD_OFFSET_COUNT];
            for(int i = 0; i < GUARD_OFFSET_COUNT; i++)
            {
                guardOffsets[i] = new RiotGuardOffset();
            }
        }
Exemplo n.º 2
0
        public void Reset(SaveGame saveGame)
        {
            // HUD
            HUD.Initialize(GraphicsDevice);

            // Other components
            RiotGuardWall.Initialize(saveGame);

            // LevelManager last
            Point startingLevel = LevelManager.STARTING_LEVEL;
            if (saveGame != null)
            {
                startingLevel = new Point(saveGame.levelX, saveGame.levelY);
                Hero[] newHeroes = new Hero[RetroGame.NUM_PLAYERS];
                for(int i = 0; i < newHeroes.Length; i++)
                {
                    newHeroes[i] = new Hero(saveGame.heroStates[i]);
                }
                levelManager.heroes = newHeroes;
                levelManager.Initialize(RetroGame.NUM_PLAYERS, false, RetroGame.StoreLevelFragment, startingLevel);
            }
            else
            {
                levelManager.Initialize(RetroGame.NUM_PLAYERS, true, RetroGame.IntroLevelFragment, startingLevel);
            }
            for (int i = -1; i <= 1; i++)
                for (int j = -1; j <= 1; j++)
                {
                    if (i == 0 && j == 0)
                        continue;
                    if (RetroGame.DEBUG)
                    {
                        int sum = (i + 1) + (j + 1) * 3;
                        levelManager.createRandomLevelAt(startingLevel.X + i, startingLevel.Y + j, (sum < 8) ? sum : 0);
                    }
                    else
                    {
                        levelManager.createRandomLevelAt(startingLevel.X + i, startingLevel.Y + j);
                    }
                }
            for (int i = -1; i <= 1; i++)
                for (int j = -1; j <= 1; j++)
                {
                    if (i >= 0)
                        levelManager.levels[startingLevel.X + i, startingLevel.Y + j].updateLeftBorderColors();
                    if (j >= 0)
                        levelManager.levels[startingLevel.X + i, startingLevel.Y + j].updateTopBorderColors();
                    if (i >= 0 && j >= 0)
                        levelManager.levels[startingLevel.X + i, startingLevel.Y + j].updateCornerBorderColors();
                }
            levelManager.createAndRemoveLevels();

            currentEffect = null;
            drawEffects = false;
        }
Exemplo n.º 3
0
        // Reset game from game over to start over again
        public static void Reset(SaveGame saveGame = null)
        {
            //LoadConfig();
            State = GameState.Arena;
            storeChargeTime = (DEBUG) ? STORE_CHARGE_TIME : 0;
            StoreCharge = 0;

            Prisoner.Initialize();
            History.ResetReversibles();
            if(saveGame != null)
                Level.Initialize(saveGame.cellOffset1, saveGame.cellOffset2);
            else
                Level.Initialize();
            retroStatisActive = false;
            EscapeScreen.levelManager.Camera = null; // make it use a whole new camera on initialize
            EscapeScreen.Reset(saveGame);
            if (saveGame != null)
            {
                saveGame.inventoryState.Restore();
                Score = saveGame.score;
                AvailableGems = saveGame.AvailableGems;
                AvailableSand = saveGame.AvailableSand;
                AvailableBombs = saveGame.AvailableBombs;
                HasDrilled = true;
                Saves.LastSaveFilename = saveGame.filename;
                Powerups.DummyPowerups[typeof(HealthPickup)].GemCost = saveGame.healthCost;
                Powerups.DummyPowerups[typeof(RevivePickup)].GemCost = saveGame.reviveCost;
            }
            else
            {
                Score = 0;
                AvailableGems = 0;
                AvailableSand = 0;
                AvailableBombs = 0;
                HasDrilled = false;
            }
            SoundManager.PlaySoundAsMusic("MainTheme");
            SoundManager.SetMusicVolumeSmooth(MenuScreen.BACKGROUND_MUSIC_VOLUME, 0.33f);
            Highscores.Initialize();
        }