示例#1
0
        /// <summary>
        /// Allows the game to perform any initialization it needs to before starting to run.
        /// This is where it can query for any required services and load any non-graphic
        /// related content.  Calling base.Initialize will enumerate through any components
        /// and initialize them as well.
        /// </summary>
        protected override void Initialize()
        {
            //Camera
            Camera = new Camera2D(this, GraphicsDevice.Viewport);

            // Factories - item and sprite
            SFactory = new SpriteFactory();
            IFactory = new ItemFactory(this);

            // Collision Detector
            Detection    = new CollisionDetection(this);
            soundEffects = new List <SoundEffect>();

            // Adding all of the commands into the keyboard controller
            keyboardCommands[0]  = new LinkWalkUp(this);
            keyboardCommands[1]  = new LinkWalkDown(this);
            keyboardCommands[2]  = new LinkWalkLeft(this);
            keyboardCommands[3]  = new LinkWalkRight(this);
            keyboardCommands[4]  = new LinkAttack(this);
            keyboardCommands[5]  = new LinkBomb(this);
            keyboardCommands[6]  = new LinkArrow(this);
            keyboardCommands[7]  = new LinkCandle(this);
            keyboardCommands[8]  = new LinkBoomerang(this);
            keyboardCommands[9]  = new Reset(this);
            keyboardCommands[10] = new Quit(this);
            keyboardCommands[11] = new Pause(this);
            keyboardCommands[13] = new LinkGun(this);

            keyboardController = new KeyboardController(this, keyboardKeys, keyboardCommands);
            keyboardCheater    = new KeyboardCheater(this);

            mouseCommands[0] = new ChangeRoom(this);
            mouseController  = new MouseController(this, mouseCommands);
            vsbag            = new VisualBag();

            //Game State
            PlayingState   = new GamePlayingState(this);
            InventoryState = new GameInventoryState(this);
            PauseState     = new GamePausedState(this);



            CurrentGameState = PlayingState;
            GameEnumState    = States.GameState.GamePlayingState;

            // Game base
            base.Initialize();
        }
        public PickupLink(Game1 game, Link link)
        {
            Game = game;
            decoratedLink = link;
            Sprite = decoratedLink.Sprite;
            Sprite.FPS = 4;
            Hitbox = decoratedLink.Hitbox;
            Position = decoratedLink.Position;
            Direction = decoratedLink.Direction;
            HP = decoratedLink.HP;
            MaxHP = decoratedLink.MaxHP;
            r = new Reset(Game);
            gameChanger = new GameChanger(Game);
            Sprite.ChangeSpriteAnimation("Pickup");

            /*            TriForcePepe = game.Content.Load<Texture2D>("WinningGame");
                        YOUWON = game.Content.Load<Texture2D>("YOU WON");*/
            // Game.changeSong();

        }
示例#3
0
        private void DeathBed()
        {
            ICommand reset = new Reset(Game);

            reset.Execute();
        }