Ejemplo n.º 1
0
 public DungeonMap(IMapCreationStrategy <Map> strategy, int tileSize = 64, float tileScale = 1.0f)
 {
     Strategy   = strategy;
     TileSize   = tileSize;
     TileScale  = tileScale;
     CurrentMap = Map.Create(strategy);
 }
Ejemplo n.º 2
0
        /// <summary>
        /// Static factory method which creates a new Map using the specified IMapCreationStrategy
        /// </summary>
        /// <remarks>
        /// Several classes implementing IMapCreationStrategy are included with RogueSharp but they are very basic
        /// It recommended that you create your own class implementing this interface to create more interesting Maps
        /// </remarks>
        /// <param name="mapCreationStrategy">A class that implements IMapCreationStrategy and has CreateMap method which defines algorithms for creating interesting Maps</param>
        /// <returns>Map created by calling CreateMap from the specified IMapCreationStrategy</returns>
        /// <exception cref="ArgumentNullException">Thrown on null map creation strategy</exception>
        public static Map Create(IMapCreationStrategy <Map> mapCreationStrategy)
        {
            if (mapCreationStrategy == null)
            {
                throw new ArgumentNullException("mapCreationStrategy", "Map creation strategy cannot be null");
            }

            return(mapCreationStrategy.CreateMap());
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Static factory method which creates a new Map using the specified IMapCreationStrategy
        /// </summary>
        /// <remarks>
        /// Several classes implementing IMapCreationStrategy are included with RogueSharp but they are very basic
        /// It recommended that you create your own class implementing this interface to create more interesting Maps
        /// </remarks>
        /// <param name="mapCreationStrategy">A class that implements IMapCreationStrategy and has CreateMap method which defines algorithms for creating interesting Maps</param>
        /// <returns>Map created by calling CreateMap from the specified IMapCreationStrategy</returns>
        /// <exception cref="ArgumentNullException">Thrown on null map creation strategy</exception>
        public static T Create <T>(IMapCreationStrategy <T> mapCreationStrategy) where T : IMap
        {
            if (mapCreationStrategy == null)
            {
                throw new ArgumentNullException(nameof(mapCreationStrategy), "Map creation strategy cannot be null");
            }

            return(mapCreationStrategy.CreateMap());
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Static factory method which creates a new Map using the specified IMapCreationStrategy
        /// </summary>
        /// <remarks>
        /// Several classes implementing IMapCreationStrategy are included with RogueSharp but they are very basic
        /// It recommended that you create your own class implementing this interface to create more interesting Maps
        /// </remarks>
        /// <param name="mapCreationStrategy">A class that implements IMapCreationStrategy and has CreateMap method which defines algorithms for creating interesting Maps</param>
        /// <returns>Map created by calling CreateMap from the specified IMapCreationStrategy</returns>
        /// <exception cref="ArgumentNullException">Thrown on null map creation strategy</exception>
        public static TMap Create <TMap, TCell>(IMapCreationStrategy <TMap, TCell> mapCreationStrategy) where TMap : IMap <TCell> where TCell : ICell
        {
            if (mapCreationStrategy == null)
            {
                throw new ArgumentNullException(nameof(mapCreationStrategy), "Map creation strategy cannot be null");
            }

            return(mapCreationStrategy.CreateMap());
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Static factory method which creates a new Map using the specified IMapCreationStrategy
        /// </summary>
        /// <remarks>
        /// Several classes implementing IMapCreationStrategy are included with RogueSharp but they are very basic
        /// It recommended that you create your own class implementing this interface to create more interesting Maps
        /// </remarks>
        /// <param name="mapCreationStrategy">A class that implements IMapCreationStrategy and has CreateMap method which defines algorithms for creating interesting Maps</param>
        /// <returns>Map created by calling CreateMap from the specified IMapCreationStrategy</returns>
        /// <exception cref="ArgumentNullException">Thrown on null map creation strategy</exception>
        public static Map Create( IMapCreationStrategy<Map> mapCreationStrategy )
        {
            if ( mapCreationStrategy == null )
             {
            throw new ArgumentNullException( "mapCreationStrategy", "Map creation strategy cannot be null" );
             }

             return mapCreationStrategy.CreateMap();
        }
Ejemplo n.º 6
0
        /// <summary>
        /// Static factory method which creates a new Map using the specified IMapCreationStrategy
        /// </summary>
        /// <param name="mapCreationStrategy">A class that implements IMapCreationStrategy and has CreateMap method which defines algorithms for creating interesting Maps</param>
        public static Map Create(IMapCreationStrategy <Map> mapCreationStrategy)
        {
            if (mapCreationStrategy == null)
            {
                if (LogFilter.logError)
                {
                    Debug.LogErrorFormat("Map creation strategy cannot be null");
                }
            }

            return(mapCreationStrategy.CreateMap());
        }
Ejemplo n.º 7
0
        public MapLevel(int width, int height, IMapCreationStrategy <RogueSharp.Map> mapCreationStrategy, ITextSurfaceRendered textSurface)
        {
            Width  = width;
            Height = height;
            //All this for the generic type argument.
            Type[] typeArgs      = mapCreationStrategy.GetType().GetGenericArguments();
            Type   genericMapGen = typeof(MapGenerator <>);
            Type   constructed   = genericMapGen.MakeGenericType(typeArgs);

            mapGenerator = (MapGenerator <RogueSharp.Map>)Activator.CreateInstance(constructed, width, height, mapCreationStrategy, textSurface);


            EntityContainer = new EntityContainer();
            ItemContainer   = new ItemContainer();
            MapData         = mapGenerator.CreateMap();
        }
Ejemplo n.º 8
0
        public Level(IMapCreationStrategy <Map> mapCreationStrategy)
        {
            _dungeonMap = Map.Create(mapCreationStrategy);

            _enemies = new List <Enemie>()
            {
                new Enemie(GetRandomWalkableCell(), "g", 4)
                {
                    Color = Color.GreenYellow
                }
            };
            _item = new List <IItem>()
            {
                new Weapon(GetRandomWalkableCell())
                {
                    Name = "Eskalibur", Description = "Bardzo wazny miecz z legendy o krolu Arturze."
                }
            };
        }
Ejemplo n.º 9
0
 public static LibtcodMap Create(IMapCreationStrategy <LibtcodMap> mapCreationStrategy)
 {
     return(mapCreationStrategy.CreateMap());
 }
Ejemplo n.º 10
0
 public static LibtcodMap Create( IMapCreationStrategy<LibtcodMap> mapCreationStrategy )
 {
     return mapCreationStrategy.CreateMap();
 }
Ejemplo n.º 11
0
        public MapGenerator(int width, int height, IMapCreationStrategy <T> mapCreationStrategy, ITextSurfaceRendered textSurface)
        {
            this.mapCreationStrategy = mapCreationStrategy;

            dataMap = new MapData(width, height, textSurface);
        }