Exemple #1
0
            /// <summary>
            /// Initializes a new instance of the <see cref="NPCSpawnerNPC"/> class.
            /// </summary>
            /// <param name="spawner">The spawner.</param>
            /// <param name="parent">World that the NPC belongs to.</param>
            /// <param name="template">NPCTemplate used to create the NPC.</param>
            /// <param name="map">The map.</param>
            /// <param name="position">The position.</param>
            /// <exception cref="ArgumentNullException"><paramref name="spawner" /> is <c>null</c>.</exception>
            public NPCSpawnerNPC(NPCSpawner spawner, World parent, CharacterTemplate template, Map map, Vector2 position)
                : base(parent, template, map, position)
            {
                if (spawner == null)
                {
                    throw new ArgumentNullException("spawner");
                }

                _spawner = spawner;
            }
Exemple #2
0
        /// <summary>
        /// Loads the NPCSpawners for a Map.
        /// </summary>
        /// <param name="map">Map to load the spawners for.</param>
        /// <returns>IEnumerable of the <see cref="NPCSpawner"/>s that were loaded.</returns>
        public static IEnumerable <NPCSpawner> LoadSpawners(Map map)
        {
            var queryValues = MapSpawnValues.Load(map.DbController, map.ID);
            var ret         = new List <NPCSpawner>();

            foreach (var queryValue in queryValues)
            {
                var spawner = new NPCSpawner(queryValue, map);
                ret.Add(spawner);
            }

            return(ret);
        }
Exemple #3
0
            /// <summary>
            /// Initializes a new instance of the <see cref="NPCSpawnerNPC"/> class.
            /// </summary>
            /// <param name="spawner">The spawner.</param>
            /// <param name="parent">World that the NPC belongs to.</param>
            /// <param name="template">NPCTemplate used to create the NPC.</param>
            /// <param name="map">The map.</param>
            /// <param name="position">The position.</param>
            /// <param name="spawnDirection">The direction to spawn in</param>
            /// <exception cref="ArgumentNullException"><paramref name="spawner" /> is <c>null</c>.</exception>
            public NPCSpawnerNPC(NPCSpawner spawner, World parent, CharacterTemplate template, Map map, Vector2 position, Direction spawnDirection, ushort respawn)
                : base(parent, template, map, position)
            {
                if (spawner == null)
                {
                    throw new ArgumentNullException("spawner");
                }

                // Set the heading for this NPC
                Heading = spawnDirection;
                // Set the amount of seconds before respawning
                RespawnSecs = respawn;

                _spawner = spawner;
            }
Exemple #4
0
            /// <summary>
            /// Initializes a new instance of the <see cref="NPCSpawnerNPC"/> class.
            /// </summary>
            /// <param name="spawner">The spawner.</param>
            /// <param name="parent">World that the NPC belongs to.</param>
            /// <param name="template">NPCTemplate used to create the NPC.</param>
            /// <param name="map">The map.</param>
            /// <param name="position">The position.</param>
            /// <param name="spawnDirection">The direction to spawn in</param>
            /// <exception cref="ArgumentNullException"><paramref name="spawner" /> is <c>null</c>.</exception>
            public NPCSpawnerNPC(NPCSpawner spawner, World parent, CharacterTemplate template, Map map, Vector2 position, Direction spawnDirection, ushort respawn)
                : base(parent, template, map, position)
            {
                if (spawner == null)
                    throw new ArgumentNullException("spawner");

                // Set the heading for this NPC
                Heading = spawnDirection;
                // Set the amount of seconds before respawning
                RespawnSecs = respawn;

                _spawner = spawner;
            }
Exemple #5
0
        /// <summary>
        /// Loads the NPCSpawners for a Map.
        /// </summary>
        /// <param name="map">Map to load the spawners for.</param>
        /// <returns>IEnumerable of the <see cref="NPCSpawner"/>s that were loaded.</returns>
        public static IEnumerable<NPCSpawner> LoadSpawners(Map map)
        {
            var queryValues = MapSpawnValues.Load(map.DbController, map.ID);
            var ret = new List<NPCSpawner>();

            foreach (var queryValue in queryValues)
            {
                var spawner = new NPCSpawner(queryValue, map);
                ret.Add(spawner);
            }

            return ret;
        }
Exemple #6
0
            /// <summary>
            /// Initializes a new instance of the <see cref="NPCSpawnerNPC"/> class.
            /// </summary>
            /// <param name="spawner">The spawner.</param>
            /// <param name="parent">World that the NPC belongs to.</param>
            /// <param name="template">NPCTemplate used to create the NPC.</param>
            /// <param name="map">The map.</param>
            /// <param name="position">The position.</param>
            /// <exception cref="ArgumentNullException"><paramref name="spawner" /> is <c>null</c>.</exception>
            public NPCSpawnerNPC(NPCSpawner spawner, World parent, CharacterTemplate template, Map map, Vector2 position)
                : base(parent, template, map, position)
            {
                if (spawner == null)
                    throw new ArgumentNullException("spawner");

                _spawner = spawner;
            }
Exemple #7
0
 /// <summary>
 /// Handles loading the <see cref="NPCSpawner"/>s on the map.
 /// </summary>
 /// <returns>The <see cref="NPCSpawner"/>s on the map.</returns>
 protected IEnumerable <NPCSpawner> LoadNPCSpawners()
 {
     return(NPCSpawner.LoadSpawners(this).ToCompact());
 }