コード例 #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;
                }
            }
        }
コード例 #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;
            }
        }
コード例 #3
0
ファイル: NPCSpawner.cs プロジェクト: wtfcolt/game
        /// <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;
                }
            }
        }
コード例 #4
0
ファイル: NPCSpawner.cs プロジェクト: mateuscezar/netgore
        /// <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;
                }
            }
        }
コード例 #5
0
ファイル: NPCSpawner.cs プロジェクト: mateuscezar/netgore
        /// <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;
            }
        }
コード例 #6
0
ファイル: NPCSpawner.cs プロジェクト: wtfcolt/game
        /// <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;
                }
            }
        }