Example #1
0
        /// <summary>
        /// Spawns the NPCs for this <see cref="NPCSpawner"/>.
        /// </summary>
        void SpawnNPCs()
        {
            if (_npcs != null)
            {
                foreach (var npc in _npcs)
                {
                    npc.DelayedDispose();
                }
            }

            _npcs = new NPCSpawnerNPC[Amount];

            for (var i = 0; i < Amount; i++)
            {
                Vector2?pos = RandomSpawnPosition(_characterTemplateBody);
                if (pos.HasValue)
                {
                    Array values = Enum.GetValues(typeof(Direction));

                    // Get the direction
                    var dir = _spawnDirection;

                    if (dir == Direction.None)
                    {
                        dir = (Direction)values.GetValue(RandomHelper.NextInt(1, values.Length));
                    }

                    NPCSpawnerNPC npc = new NPCSpawnerNPC(this, _map.World, _characterTemplate, _map, pos.Value, dir, _respawn);
                    _npcs[i] = npc;
                }
            }
        }
Example #2
0
        /// <summary>
        /// Spawns the NPCs for this <see cref="NPCSpawner"/>.
        /// </summary>
        void SpawnNPCs()
        {
            if (_npcs != null)
            {
                foreach (var npc in _npcs)
                {
                    npc.DelayedDispose();
                }
            }

            _npcs = new NPCSpawnerNPC[Amount];

            for (var i = 0; i < Amount; i++)
            {
                var pos = RandomSpawnPosition();
                var npc = new NPCSpawnerNPC(this, _map.World, _characterTemplate, _map, pos);
                _npcs[i] = npc;
            }
        }
Example #3
0
        /// <summary>
        /// Spawns the NPCs for this <see cref="NPCSpawner"/>.
        /// </summary>
        void SpawnNPCs()
        {
            if (_npcs != null)
            {
                foreach (var npc in _npcs)
                {
                    npc.DelayedDispose();
                }
            }

            _npcs = new NPCSpawnerNPC[Amount];

            for (var i = 0; i < Amount; i++)
            {
                Vector2?pos = RandomSpawnPosition(_characterTemplateBody);
                if (pos.HasValue)
                {
                    NPCSpawnerNPC npc = new NPCSpawnerNPC(this, _map.World, _characterTemplate, _map, pos.Value);
                    _npcs[i] = npc;
                }
            }
        }
Example #4
0
        /// <summary>
        /// Spawns the NPCs for this <see cref="NPCSpawner"/>.
        /// </summary>
        void SpawnNPCs()
        {
            if (_npcs != null)
            {
                foreach (var npc in _npcs)
                {
                    npc.DelayedDispose();
                }
            }

            _npcs = new NPCSpawnerNPC[Amount];

            for (var i = 0; i < Amount; i++)
            {
                Vector2? pos = RandomSpawnPosition(_characterTemplateBody);                                
                if (pos.HasValue)
                {   

                    Array values = Enum.GetValues(typeof(Direction));

                    // Get the direction
                    var dir = _spawnDirection;

                    if (dir == Direction.None)
                        dir = (Direction) values.GetValue(RandomHelper.NextInt(1, values.Length));

                    NPCSpawnerNPC npc = new NPCSpawnerNPC(this, _map.World, _characterTemplate, _map, pos.Value, dir, _respawn);
                    _npcs[i] = npc;
                }
            }
        }
Example #5
0
        /// <summary>
        /// Spawns the NPCs for this <see cref="NPCSpawner"/>.
        /// </summary>
        void SpawnNPCs()
        {
            if (_npcs != null)
            {
                foreach (var npc in _npcs)
                {
                    npc.DelayedDispose();
                }
            }

            _npcs = new NPCSpawnerNPC[Amount];

            for (var i = 0; i < Amount; i++)
            {
                var pos = RandomSpawnPosition();
                var npc = new NPCSpawnerNPC(this, _map.World, _characterTemplate, _map, pos);
                _npcs[i] = npc;
            }
        }
Example #6
0
        /// <summary>
        /// Spawns the NPCs for this <see cref="NPCSpawner"/>.
        /// </summary>
        void SpawnNPCs()
        {
            if (_npcs != null)
            {
                foreach (var npc in _npcs)
                {
                    npc.DelayedDispose();
                }
            }

            _npcs = new NPCSpawnerNPC[Amount];

            for (var i = 0; i < Amount; i++)
            {
                Vector2? pos = RandomSpawnPosition(_characterTemplateBody);
                if (pos.HasValue)
                {
                    NPCSpawnerNPC npc = new NPCSpawnerNPC(this, _map.World, _characterTemplate, _map, pos.Value);
                    _npcs[i] = npc;
                }
            }
        }