Пример #1
0
        /// <summary>
        /// 重設場景
        /// </summary>
        public void Reset()
        {
            IsStart     = false;
            IsEnding    = false;
            PlayingInfo = new ScenePlayingInfo(SceneInfo.SceneID, Level, SceneInfo.GetPlayingTimeLimit(Level));
            SceneSlow   = 1F;
            GameObjects.Clear();
            EffectObjects.Clear();
            Waves.Clear();
            SetWave();

            int maxWave = 0;

            foreach (WaveLine wave in Waves)
            {
                maxWave = Math.Max(maxWave, wave.Length);
            }
            WaveNo.Limit              = maxWave;
            WaveNo.Value              = 0;
            WaveCounter.Value         = 0;
            MenuCooldownCounter.Value = MenuCooldownCounter.Limit;

            Padding padding = Global.DefaultMainRectanglePadding;

            MainRectangle = new Rectangle(padding.Left, padding.Top, Width - padding.Horizontal, Height - padding.Vertical);
        }
Пример #2
0
        private void OnTick()
        {
            if (!OnGoing && DateTime.UtcNow > NextStart && Region != null && Region.GetPlayerCount() > 0)
            {
                NextStart = DateTime.MaxValue;
                OnGoing   = true;
                VoidType  = (VoidType)Utility.Random(5);
                PoolHits  = PoolStartHits;
                Wave      = 0;

                if (CurrentScore != null)
                {
                    CurrentScore.Clear();
                }

                if (Waves != null)
                {
                    Waves.Clear();
                    Waves.TrimExcess();
                }

                CurrentScore = new Dictionary <Mobile, long>();
                Waves        = new List <WaveInfo>();

                Region.SendRegionMessage(1152527, 0x2B);                 // The battle for the Void Pool is beginning now!

                if (WaypointACount != WaypointsA.Count || WaypointBCount != WaypointsB.Count)
                {
                    Generate.AddWaypoints();
                }

                SpawnWave();
            }
            else if (OnGoing)
            {
                if (DateTime.UtcNow > NextWave)
                {
                    SpawnWave();
                }

                IPooledEnumerable eable = this.Map.GetMobilesInBounds(PoolWalls);
                foreach (Mobile m in eable)
                {
                    if (!OnGoing)
                    {
                        break;
                    }

                    if (m is BaseCreature && !((BaseCreature)m).Controlled && !((BaseCreature)m).Summoned && Utility.RandomDouble() > 0.25)
                    {
                        OnVoidWallDamaged(m);
                    }
                }
                eable.Free();
            }
        }