Пример #1
0
 public DeathState(ZeldaGame game)
 {
     this.game = game;
     game.spriteSheets.TryGetValue("GameOver", out gameOverSpriteSheet);
     texture = new UniversalSprite(game, gameOverSpriteSheet, new Rectangle(36, 126, WIDTH, HEIGHT), Color.White, SpriteEffects.None, new Vector2(1, 1), 10, itemDepth);
     this.game.link.drawLocation = new Vector2(this.game.GraphicsDevice.Viewport.Width / 2, this.game.GraphicsDevice.Viewport.Height / 2 + ParserUtility.GAME_FRAME_ADJUST);
 }
Пример #2
0
 public FogOfWar(ZeldaGame game)
 {
     this.game             = game;
     this.spriteScalar     = game.util.spriteScalar;
     drawLocation.X        = game.link.drawLocation.X + (game.link.spriteSize.X / 2) - (spriteSize.X / 2);
     drawLocation.Y        = game.link.drawLocation.Y + (game.link.spriteSize.Y / 2) - (spriteSize.Y / 2);
     fogOfWarSpriteFactory = new FogOfWarSpriteFactory(this);
     mySprite = fogOfWarSpriteFactory.FogOfWar();
 }
Пример #3
0
 public ItemSelectState(ZeldaGame game)
 {
     this.storage = new ItemSelectStateStorage();
     this.game    = game;
     game.spriteSheets.TryGetValue("HUD", out inventorySpriteSheet);
     HudFactory       = game.hudSpriteFactory;
     top              = new UniversalSprite(game, inventorySpriteSheet, storage.topRectangle, Color.White, SpriteEffects.None, new Vector2(1, 1), storage.fpsLimiter, itemDepth);
     mid              = new UniversalSprite(game, inventorySpriteSheet, storage.midRectangle, Color.White, SpriteEffects.None, new Vector2(1, 1), storage.fpsLimiter, itemDepth);
     holdingMap       = new UniversalSprite(game, inventorySpriteSheet, storage.mapRectangle, Color.White, SpriteEffects.None, new Vector2(1, 1), storage.fpsLimiter, itemDepth);
     holdingCompass   = new UniversalSprite(game, inventorySpriteSheet, storage.compassRectangle, Color.White, SpriteEffects.None, new Vector2(1, 1), storage.fpsLimiter, itemDepth);
     pHUD             = game.currentRoom.pHUD;
     secweaponHolding = HudFactory.blankBox();
     secweaponOne     = HudFactory.blankBox();
     secweaponTwo     = HudFactory.blankBox();
     secweaponThree   = HudFactory.blankBox();
 }
Пример #4
0
        public TransitionState(ZeldaGame game, Room oldroom, Room nextroom, Collision.Collision.Direction transitionDirection)
        {
            this.game     = game;
            this.pHUD     = new playerHUD(game, game.hudSpriteFactory);
            this.oldroom  = oldroom;
            this.nextroom = nextroom;
            timer         = TransitionStateStorage.timer;

            RoomTextureStorage roomTextures = new RoomTextureStorage(this.game);

            game.spriteSheets.TryGetValue("DungeonTileset", out itemSpriteSheet);

            windowWidth  = game.GraphicsDevice.Viewport.Width;
            windowHeight = game.GraphicsDevice.Viewport.Height;

            int windowHeightFloor = ((windowHeight / ParserUtility.SCALE_FACTOR - ParserUtility.WINDOW_X_ADJUST / ParserUtility.SCALE_FACTOR) / ParserUtility.GEN_ADJUST) + ParserUtility.GAME_FRAME_ADJUST;
            int windowWidthFloor  = (windowWidth / ParserUtility.SCALE_FACTOR - ParserUtility.WINDOW_Y_ADJUST / ParserUtility.SCALE_FACTOR) / ParserUtility.GEN_ADJUST;

            roomLimiter = TransitionStateStorage.roomLimiter;
            drawOffset  = TransitionStateStorage.drawOffset;

            this.transitionDirection = transitionDirection;

            Vector2 newRoomShift = new Vector2(0, 0);

            //SLIDE
            switch (transitionDirection)
            {
            case Collision.Collision.Direction.up:
                newRoomShift = new Vector2(0, -TransitionStateStorage.roomTransitionY * ParserUtility.SCALE_FACTOR);
                timer        = TransitionStateStorage.roomTransitionY * ParserUtility.SCALE_FACTOR / animationSpeed;
                break;

            case Collision.Collision.Direction.left:
                newRoomShift = new Vector2(-TransitionStateStorage.roomTransitionX * ParserUtility.SCALE_FACTOR, 0);
                timer        = TransitionStateStorage.roomTransitionX * ParserUtility.SCALE_FACTOR / animationSpeed;
                break;

            case Collision.Collision.Direction.right:
                newRoomShift = new Vector2(TransitionStateStorage.roomTransitionX * ParserUtility.SCALE_FACTOR, 0);
                timer        = TransitionStateStorage.roomTransitionX * ParserUtility.SCALE_FACTOR / animationSpeed;
                break;

            case Collision.Collision.Direction.down:
                newRoomShift = new Vector2(0, TransitionStateStorage.roomTransitionY * ParserUtility.SCALE_FACTOR);
                timer        = TransitionStateStorage.roomTransitionY * ParserUtility.SCALE_FACTOR / animationSpeed;
                break;
            }

            drawLocationInteriorOld = new Vector2(windowWidthFloor + drawOffset, windowHeightFloor + drawOffset);
            drawLocationExteriorOld = new Vector2(windowWidthFloor, windowHeightFloor);


            drawLocationInteriorNext = new Vector2(windowWidthFloor + drawOffset, windowHeightFloor + drawOffset) + newRoomShift;
            drawLocationExteriorNext = new Vector2(windowWidthFloor, windowHeightFloor) + newRoomShift;


            int oldRoomNumber = this.oldroom.getRoomNumber();

            roominteriorOld = roomTextures.getRoom(oldRoomNumber);

            int nextRoomNumber = nextroom.getRoomNumber();

            roominteriorNext = roomTextures.getRoom(nextRoomNumber);

            roomexteriorNext = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.exteriorTemp, Color.White, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);

            if (this.oldroom.getRoomNumber() == TransitionStateStorage.specialRoomNumber)
            {
                roomexteriorOld         = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.exteriorActual, Color.White, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
                drawLocationInteriorOld = drawLocationInteriorOld - new Vector2(0, TransitionStateStorage.interiorPosAdjust);
                roominteriorOld         = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.exteriorActual, Color.Transparent, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
            }
            else
            {
                roomexteriorOld = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.exteriorTemp, Color.White, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
            }

            if (this.nextroom.getRoomNumber() == TransitionStateStorage.specialRoomNumber)
            {
                roomexteriorNext = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.exteriorActual, Color.White, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
                roominteriorNext = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.exteriorActual, Color.Transparent, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
            }
            else
            {
                roomexteriorNext = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.exteriorTemp, Color.White, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
            }

            drawLocationTopDoorOld    = new Vector2(windowWidthFloor + TransitionStateStorage.verticalDoorAdjust * ParserUtility.SCALE_FACTOR, windowHeightFloor);
            drawLocationLeftDoorOld   = new Vector2(windowWidthFloor, windowHeightFloor + TransitionStateStorage.smallAdjust * ParserUtility.SCALE_FACTOR);
            drawLocationRightDoorOld  = new Vector2(windowWidthFloor + TransitionStateStorage.horizontalDoorAdjust * ParserUtility.SCALE_FACTOR, windowHeightFloor + TransitionStateStorage.smallAdjust * ParserUtility.SCALE_FACTOR);
            drawLocationBottomDoorOld = new Vector2(windowWidthFloor + TransitionStateStorage.verticalDoorAdjust * ParserUtility.SCALE_FACTOR, windowHeightFloor + TransitionStateStorage.largeAdjust * ParserUtility.SCALE_FACTOR);

            drawLocationTopDoorNext    = new Vector2(windowWidthFloor + TransitionStateStorage.verticalDoorAdjust * ParserUtility.SCALE_FACTOR, windowHeightFloor) + newRoomShift;
            drawLocationLeftDoorNext   = new Vector2(windowWidthFloor, windowHeightFloor + TransitionStateStorage.smallAdjust * ParserUtility.SCALE_FACTOR) + newRoomShift;
            drawLocationRightDoorNext  = new Vector2(windowWidthFloor + TransitionStateStorage.horizontalDoorAdjust * ParserUtility.SCALE_FACTOR, windowHeightFloor + TransitionStateStorage.smallAdjust * ParserUtility.SCALE_FACTOR) + newRoomShift;
            drawLocationBottomDoorNext = new Vector2(windowWidthFloor + TransitionStateStorage.verticalDoorAdjust * ParserUtility.SCALE_FACTOR, windowHeightFloor + TransitionStateStorage.largeAdjust * ParserUtility.SCALE_FACTOR) + newRoomShift;

            foreach (IDoor door in oldroom.getDoors())
            {
                if (door.GetType() == typeof(TopDoor))
                {
                    topDoorOld = roomTextures.getDoor(door.getDoorValue());
                }
                else if (door.GetType() == typeof(LeftDoor))
                {
                    leftDoorOld = roomTextures.getDoor(door.getDoorValue());
                }
                else if (door.GetType() == typeof(RightDoor))
                {
                    rightDoorOld = roomTextures.getDoor(door.getDoorValue());
                }
                else if (door.GetType() == typeof(BottomDoor))
                {
                    bottomDoorOld = roomTextures.getDoor(door.getDoorValue());
                }
            }

            foreach (IDoor door in nextroom.getDoors())
            {
                if (door.GetType() == typeof(TopDoor))
                {
                    topDoorNext = roomTextures.getDoor(door.getDoorValue());
                }
                else if (door.GetType() == typeof(LeftDoor))
                {
                    leftDoorNext = roomTextures.getDoor(door.getDoorValue());
                }
                else if (door.GetType() == typeof(RightDoor))
                {
                    rightDoorNext = roomTextures.getDoor(door.getDoorValue());
                }
                else if (door.GetType() == typeof(BottomDoor))
                {
                    bottomDoorNext = roomTextures.getDoor(door.getDoorValue());
                }
            }

            foreach (ITile tile in oldroom.getTiles())
            {
                if (tile.GetType() == typeof(PushableTile))
                {
                    this.oldTile = (PushableTile)tile;
                    foundOldTile = true;
                }
            }

            foreach (ITile tile in nextroom.getTiles())
            {
                if (tile.GetType() == typeof(PushableTile))
                {
                    this.nextTile = (PushableTile)tile;
                    foundNextTile = true;
                }
            }

            if (foundOldTile)
            {
                oldTile.pushed = false;
                drawLocationOldPushableTile = oldTile.drawLocation;
                oldPushableTile             = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.pushableTile, Color.White, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
            }
            if (foundNextTile)
            {
                drawLocationNextPushableTile = nextTile.drawLocation + newRoomShift;
                nextTile.pushed  = false;
                nextPushableTile = new UniversalSprite(game, itemSpriteSheet, TransitionStateStorage.pushableTile, Color.White, SpriteEffects.None, new Vector2(1, 1), roomLimiter, 0.0f);
            }
        }
Пример #5
0
 public PauseState(ZeldaGame game)
 {
     this.game = game;
     game.spriteSheets.TryGetValue("Fonts", out pausedSpriteSheet);
     texture = new UniversalSprite(game, pausedSpriteSheet, new Rectangle(364, 283, WIDTH, HEIGHT), Color.White, SpriteEffects.None, new Vector2(1, 1), 10, itemDepth);
 }
Пример #6
0
 public RoshiDialogState(ZeldaGame game)
 {
     this.game = game;
     game.spriteSheets.TryGetValue("Fonts", out roshiDialog);
     texture = new UniversalSprite(game, roshiDialog, new Rectangle(301, 317, WIDTH, HEIGHT), Color.White, SpriteEffects.None, new Vector2(3, 1), 10, itemDepth);
 }