Exemple #1
0
        public BombDoor(IDungeonManager dungeon, Point location, BlockType block) : base(dungeon, location, UnblockedType(block))
        {
            _block = block;
            switch (block)
            {
            case BlockType.BombableWallRight:
                TransitionEffect = new Transition(dungeon, Direction.Right, true);
                break;

            case BlockType.BombableWallLeft:
                TransitionEffect = new Transition(dungeon, Direction.Left, true);
                break;

            case BlockType.BombableWallTop:
                TransitionEffect = new Transition(dungeon, Direction.Up, true);
                break;

            case BlockType.BombableWallBottom:
                TransitionEffect = new Transition(dungeon, Direction.Down, true);
                break;

            default:
                throw new ArgumentOutOfRangeException(block.ToString());
            }
        }
        // ReSharper disable once SuggestBaseTypeForParameter (the input must be a jagged int array)
        public SurvivalRoom(IDungeonManager manager, int[][] tiles)
        {
            _survivalManager = manager;

            Func <MapTile, Point, bool>[] possibleBlocks =
            {
                TryAddBarrier,
                TryAddProjectilPassthroughBarrier,
                TryAddNormalDoor,
                TryAddNonStandardTiles,
                TryAddShopTiles
            };

            for (var row = 0; row < tiles.Length; row++)
            {
                for (var col = 0; col < tiles[row].Length; col++)
                {
                    var location = new Point(col * TileWidthHeight, row * TileWidthHeight);
                    var tile     = (MapTile)tiles[row][col];
                    var success  = false;
                    foreach (var possibleBlock in possibleBlocks)
                    {
                        success = possibleBlock(tile, location);
                        if (success)
                        {
                            break;
                        }
                    }
                    if (!success)
                    {
                        throw new ArgumentOutOfRangeException(tile.ToString());
                    }
                }
            }
        }
        public LockedDoor(IDungeonManager dungeon, Point location, BlockType block) : base(dungeon, location, UnlockedType(block))
        {
            _block = block;
            switch (block)
            {
            case BlockType.DoorLockedRight:
                TransitionEffect = new Transition(dungeon, Direction.Right, true);
                break;

            case BlockType.DoorLockedLeft:
                TransitionEffect = new Transition(dungeon, Direction.Left, true);
                break;

            case BlockType.DoorLockedUp:
                TransitionEffect = new Transition(dungeon, Direction.Up, true);
                break;

            case BlockType.DoorLockedDown:
                TransitionEffect = new Transition(dungeon, Direction.Down, true);
                break;

            default:
                throw new ArgumentOutOfRangeException(block.ToString());
            }
            _sprite = new AlphaPassMask(BlockTypeSprite.Sprite(_block), true);
        }
        public NormalDoor(IDungeonManager dungeon, Point location, BlockType block)
        {
            Location   = location;
            DrawOffset = Point.Zero;

            switch (block)
            {
            case BlockType.DoorRight:
                Size             = new Point(32, 48);
                NoOpArea         = new Rectangle(0, 16, 16, 16);
                TransitionArea   = new Rectangle(16, 16, 16, 16);
                TransitionEffect = new Transition(dungeon, Direction.Right);
                DrawOffset       = new Point(0, 8);
                break;

            case BlockType.DoorLeft:
                Size             = new Point(32, 48);
                NoOpArea         = new Rectangle(16, 16, 16, 16);
                TransitionArea   = new Rectangle(0, 16, 16, 16);
                TransitionEffect = new Transition(dungeon, Direction.Left);
                DrawOffset       = new Point(0, 8);
                break;

            case BlockType.DoorUp:
                Size             = new Point(32, 32);
                NoOpArea         = new Rectangle(8, 24, 16, 8);
                TransitionArea   = new Rectangle(8, 0, 16, 24);
                TransitionEffect = new Transition(dungeon, Direction.Up);
                break;

            case BlockType.DoorDown:
                Size             = new Point(32, 32);
                NoOpArea         = new Rectangle(8, 0, 16, 16);
                TransitionArea   = new Rectangle(8, 16, 16, 16);
                TransitionEffect = new Transition(dungeon, Direction.Down);
                break;

            default:
                throw new ArgumentOutOfRangeException(block.ToString());
            }

            Sprite = new AlphaPassMask(BlockTypeSprite.Sprite(block), true);
        }
 public Transition(IDungeonManager dungeonManager, Direction direction, bool unlock = false)
 {
     _dungeonManager = dungeonManager;
     _direction      = direction;
     _unlock         = unlock;
 }
 public DoorSpecialRight3_1(IDungeonManager dungeon, Point location) : base(dungeon, location, BlockType.DoorRight)
 {
     TransitionEffect = new Transition(dungeon, Direction.Right, true);
     _sprite          = BlockTypeSprite.Sprite(BlockType.DoorSpecialRight3_1);
 }