Exemplo n.º 1
0
        /// <summary>
        /// Spawns all creatures for spawn, or amount.
        /// </summary>
        /// <param name="spawn"></param>
        /// <returns></returns>
        public int Spawn(CreatureSpawn spawn, int amount = 0)
        {
            var result = 0;
            if (amount == 0)
                amount = spawn.Amount;

            for (int i = 0; i < amount; ++i)
            {
                var pos = spawn.GetRandomPosition();
                if (this.Spawn(spawn.RaceId, spawn.RegionId, pos.X, pos.Y, spawn.Id, false, false) == null)
                    return result;

                result++;
            }

            return result;
        }
Exemplo n.º 2
0
 /// <summary>
 /// Adds spawn.
 /// </summary>
 /// <param name="spawn"></param>
 public void AddCreatureSpawn(CreatureSpawn spawn)
 {
     _creatureSpawns[spawn.Id] = spawn;
 }