Example #1
0
        private void RestartGame()
        {
            winLabel.Visible = false;

            player.Left = this.ClientSize.Width / 2;
            player.Top  = this.ClientSize.Height - 33;

            score = 100.0;

            if (isGameFinished)
            {
                isGameFinished = false;
            }

            SpawnerTimer.Start();
            GameTimer.Start();
        }
Example #2
0
        private void SetupBoard(object sender, EventArgs e)
        {
            GameTimer.Start();
            SpawnerTimer.Start();

            int i = 0;

            foreach (Control x in this.Controls)
            {
                if ((string)x.Tag == "enemy" || (string)x.Tag == "leaf")
                {
                    if (i % 2 == 0)
                    {
                        movableObjs[i] = new MovableObj(this.ClientSize.Width, (PictureBox)x, 1);
                    }
                    else
                    {
                        movableObjs[i] = new MovableObj(this.ClientSize.Width, (PictureBox)x, -1);
                    }

                    i++;
                }
            }
        }
Example #3
0
		public void DoTimer( TimeSpan delay )
		{
			if( !m_Running )
				return;

			m_End = DateTime.Now + delay;

			if( m_Timer != null )
				m_Timer.Stop();

			m_Timer = new SpawnerTimer( this, delay );
			m_Timer.Start();
		}
Example #4
0
        /// <summary>
        /// Loads the object
        /// </summary>
        /// <param name="reader"></param>
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            m_Active        = reader.ReadBool();
            m_CurrLvl       = reader.ReadInt();
            m_HomeRange     = reader.ReadInt();
            m_LevelAmt      = reader.ReadInt();
            m_PlayerRange   = reader.ReadInt();
            m_RechargeDelay = reader.ReadDateTime();
            m_RechargeTime  = reader.ReadTimeSpan();
            m_SpawnStarted  = reader.ReadBool();
            m_UseRitual     = reader.ReadBool();
            m_WalkingRange  = reader.ReadInt();
            m_WaveStarted   = reader.ReadBool();

            int size = reader.ReadInt();

            m_CreaturesName = new List <string>();
            for (int i = 0; i < size; ++i)
            {
                string typeName = reader.ReadString();
                m_CreaturesName.Add(typeName);
            }

            int count = reader.ReadInt();

            m_Creatures = new List <IEntity>();
            for (int i = 0; i < count; ++i)
            {
                IEntity e = World.FindEntity(reader.ReadInt());
                if (e != null)
                {
                    m_Creatures.Add(e);
                }
            }

            // Hack to load the progression level info
            m_Levels = new List <ProgressionLevel>();
            int amt = reader.ReadInt();

            for (int i = 0; i < amt; i++)
            {
                ProgressionLevel lvl = new ProgressionLevel();
                lvl.Load(reader);
                m_Levels.Add(lvl);
            }

            m_Timer = new SpawnerTimer(this);
            if (m_Active && !m_UseRitual)
            {
                m_Timer.Start();
            }

            DateTime recupe = reader.ReadDateTime();

            if (recupe > DateTime.Now)
            {
                m_RecupeTimer = new RecupeTimer(recupe.Subtract(DateTime.Now), this);
            }

            DateTime limit = reader.ReadDateTime();

            if (limit > DateTime.Now)
            {
                m_TimeLimit = new LimitTimer(limit.Subtract(DateTime.Now), this);
            }
        }
Example #5
0
        /// <summary>
        /// Loads the object
        /// </summary>
        /// <param name="reader"></param>
        public override void Deserialize(GenericReader reader)
        {
            base.Deserialize(reader);

            m_Active = reader.ReadBool();
            m_CurrLvl = reader.ReadInt();
            m_HomeRange = reader.ReadInt();
            m_LevelAmt = reader.ReadInt();
            m_PlayerRange = reader.ReadInt();
            m_RechargeDelay = reader.ReadDateTime();
            m_RechargeTime = reader.ReadTimeSpan();
            m_SpawnStarted = reader.ReadBool();
            m_UseRitual = reader.ReadBool();
            m_WalkingRange = reader.ReadInt();
            m_WaveStarted = reader.ReadBool();

            int size = reader.ReadInt();
            m_CreaturesName = new List<string>();
            for (int i = 0; i < size; ++i)
            {
                string typeName = reader.ReadString();
                m_CreaturesName.Add(typeName);
            }

            int count = reader.ReadInt();
            m_Creatures = new List<IEntity>();
            for (int i = 0; i < count; ++i)
            {
                IEntity e = World.FindEntity(reader.ReadInt());
                if (e != null)
                    m_Creatures.Add(e);
            }

            // Hack to load the progression level info
            m_Levels = new List<ProgressionLevel>();
            int amt = reader.ReadInt();
            for (int i = 0; i < amt; i++)
            {
                ProgressionLevel lvl = new ProgressionLevel();
                lvl.Load(reader);
                m_Levels.Add(lvl);
            }

            m_Timer = new SpawnerTimer(this);
            if (m_Active && !m_UseRitual)
                m_Timer.Start();

            DateTime recupe = reader.ReadDateTime();
            if (recupe > DateTime.Now)
                m_RecupeTimer = new RecupeTimer(recupe.Subtract(DateTime.Now),this);

            DateTime limit = reader.ReadDateTime();
            if (limit > DateTime.Now)
                m_TimeLimit = new LimitTimer(limit.Subtract(DateTime.Now), this);
        }
Example #6
0
 public void Start()
 {
     m_Timer = new SpawnerTimer(this, TimeSystem.Support.GetRandom(m_MinDelay, m_MaxDelay));
     m_Timer.Start();
 }