Beispiel #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;
        }