Exemple #1
0
        public void SetState(int inState)
        {
            int prevState = (int)state;

            state = (GameState)inState;

            if (prevState != inState && (state == GameState.LOSE || state == GameState.WIN))
            {
                //Debug.WriteLine("a");
                gameOverWinScreenCooldown = 180;//3 sec delay
            }
            if (state == GameState.PLAYING && prevState == 6)
            {
                GameplayConstants.Initialize(difficulty);
                player.InitializeFromConstants();
            }
        }
Exemple #2
0
        public GameManager(Game1 game, Dictionary <String, Texture2D> spriteSheet, SpriteFont font, SpriteFont header, Sounds sounds)
        {
            GameplayConstants.Initialize(1);//initialize constants to normal mode, just at the start so constants are somehting

            this.game = game;
            sprites   = spriteSheet;
            state     = GameState.START;

            difficulty  = 1;
            isHordeMode = false;



            //load room 17 first

            sound = sounds;

            roomLoad = new RoomLoader(sprites, this);
            rooms.Add("Room17", roomLoad.Load("Room17.txt"));
            roomKey      = "Room17";
            transitioner = new RoomTransition();

            //initialize player
            player = new Player(spriteSheet["playersheet"], new Vector2(500, 200), spriteSheet["PlayerProjectiles"], sound);

            //initailize screens
            hud        = new HUD(spriteSheet["hudSheet"], font);
            itemScreen = new ItemSelectionScreen(spriteSheet["ItemSelection"]);
            pause      = new PauseScreen(spriteSheet["MenuScreens"], font, header);
            gameOver   = new GameOverScreen(spriteSheet["MenuScreens"], font, header);
            win        = new WinScreen(spriteSheet["MenuScreens"]);
            start      = new StartMenuScreen(spriteSheet["StartMenu"], font, header, this);


            EPCol = new EnemyProjectileCollisionHandler(this);

            //initailize cheat code dictionary
            cheatCodes = new Dictionary <string, ICommand>();

            //initailize cheat codes
            ICommand extraHealth = new ExtraHealth(player);
            ICommand extraRupees = new ExtraRupees(player);
            ICommand invinc      = new Invincibility(player);
            ICommand bombs       = new UnlimitedBombs(player);

            cheatCodes.Add("NBKJH", extraHealth);
            cheatCodes.Add("MNBVX", extraRupees);
            cheatCodes.Add("ZZKNL", invinc);
            cheatCodes.Add("GFGFG", bombs);

            //initailize special move code dictionary
            specialMoves = new Dictionary <string, ICommand>();

            //initailize special moves
            ICommand fireSpin     = new FireSpinSpecialMove(this);
            ICommand reapingArrow = new ReapingArrowSpecialMove(this);
            ICommand rupeeShied   = new RupeeShieldSpecialMove(this);

            specialMoves.Add("TYHGT", fireSpin);
            specialMoves.Add("JKJKJ", reapingArrow);
            specialMoves.Add("KJHGF", rupeeShied);
        }