Server.Mobiles.IntelliSpawner.DoTimer C# (CSharp) Méthode

DoTimer() public méthode

public DoTimer ( ) : void
Résultat void
        public void DoTimer()
        {
            if (!m_Running)
                return;

            int minSeconds = (int)m_MinDelay.TotalSeconds;
            int maxSeconds = (int)m_MaxDelay.TotalSeconds;

            TimeSpan delay = TimeSpan.FromSeconds(Utility.RandomMinMax(minSeconds, maxSeconds));
            DoTimer(delay);
        }

Same methods

IntelliSpawner::DoTimer ( System.TimeSpan delay ) : void

Usage Example

            protected override void OnTick()
            {
                List <Item> spawners = new List <Item>();

                foreach (NetState state in NetState.Instances)
                {
                    if (state.Mobile != null)
                    {
                        foreach (Item item in state.Mobile.GetItemsInRange(100))
                        {
                            if (item is IntelliSpawner)
                            {
                                spawners.Add(item);
                            }
                        }
                    }
                }

                foreach (Item item in spawners)
                {
                    IntelliSpawner spawner = item as IntelliSpawner;

                    if (!spawner.Running)
                    {
                        spawner.Running = true;
                        spawner.Respawn();
                        spawner.DoTimer();
                    }
                }
            }