예제 #1
0
        public static bool IsActive()
        {
#if TIMERS
            return(Timer.Timers.GetActive() && HealthTimer.GetActive());
#else
            return(AscensionTimer.GetActive());
#endif
        }
 public HealthObject(Obj_AI_Minion obj)
 {
     Obj = obj;
     if (obj != null && obj.IsValid)
     {
         Position = obj.Position;
     }
     else
     {
         Position = new Vector3();
     }
     SpawnTime       = (int)Game.ClockTime;
     RespawnTime     = 40;
     NextRespawnTime = 0;
     Locked          = false;
     MapType         = Utility.Map.MapType.HowlingAbyss;
     Called          = false;
     TextMinimap     = new Render.Text(0, 0, "", Timer.Timers.GetMenuItem("SAssembliesTimersTextScale").GetValue <Slider>().Value, new ColorBGRA(Color4.White));
     Timer.Timers.GetMenuItem("SAssembliesTimersTextScale").ValueChanged += HealthObject_ValueChanged;
     TextMinimap.TextUpdate = delegate
     {
         return((NextRespawnTime - (int)Game.ClockTime).ToString());
     };
     TextMinimap.PositionUpdate = delegate
     {
         Vector2 sPos = Drawing.WorldToMinimap(Position);
         return(new Vector2(sPos.X, sPos.Y));
     };
     TextMinimap.VisibleCondition = sender =>
     {
         return(Timer.Timers.GetActive() && HealthTimer.GetActive() && NextRespawnTime > 0 && MapType == GMap.Type);
     };
     TextMinimap.OutLined = true;
     TextMinimap.Centered = true;
     TextMinimap.Add();
     TextMap            = new Render.Text(0, 0, "", (int)(Timer.Timers.GetMenuItem("SAssembliesTimersTextScale").GetValue <Slider>().Value * 3.5), new ColorBGRA(Color4.White));
     TextMap.TextUpdate = delegate
     {
         return((NextRespawnTime - (int)Game.ClockTime).ToString());
     };
     TextMap.PositionUpdate = delegate
     {
         Vector2 sPos = Drawing.WorldToScreen(Position);
         return(new Vector2(sPos.X, sPos.Y));
     };
     TextMap.VisibleCondition = sender =>
     {
         return(Timer.Timers.GetActive() && HealthTimer.GetActive() && NextRespawnTime > 0 && MapType == GMap.Type);
     };
     TextMap.OutLined = true;
     TextMap.Centered = true;
     TextMap.Add();
 }
예제 #3
0
 /// <summary>
 /// Starts and Stops all of the game-play timers.
 /// </summary>
 /// <returns></returns>
 public bool StartPause()
 {
     if (!running)
     {
         AnimationTimer.Start();
         AsteroidTimer.Start();
         HealthTimer.Start();
         return(true);
     }
     else
     {
         AnimationTimer.Stop();
         AsteroidTimer.Stop();
         HealthTimer.Stop();
         Invalidate();
         return(false);
     }
 }
예제 #4
0
 private void HealthTimer_Tick(object sender, EventArgs e)
 {
     if (gameover == true)
     {
         HealthTimer.Stop();
         HealthTimer.Enabled = false;
         return;
     }
     if (this.char1.Hp <= 0)
     {
         this.char1.Hp = 0;
     }
     if (this.char1.Hp > 0)
     {
         foreach (Control x in this.Controls)
         {
             if (x is PictureBox && x.Tag == "power")
             {
                 if (((PictureBox)x).Bounds.IntersectsWith(char1.player.Bounds))
                 {
                     this.Phit.Text     = "-4";
                     this.Phit.Location = new Point(this.char1.player.Location.X + 30, this.char1.player.Location.Y - 50);
                     this.Controls.Add(Phit);
                     this.Phit.Visible = true;
                     this.Phit.BringToFront();
                     this.char1.Hp -= 4;
                     this.Controls.Remove(x);
                     x.Dispose();
                 }
             }
             if (x is PictureBox && x.Tag == "Fire")
             {
                 if (((PictureBox)x).Bounds.IntersectsWith(char1.player.Bounds))
                 {
                     this.char1.Hp -= 3;
                 }
             }
             if (x is PictureBox && x.Tag == "Villain")
             {
                 if (((PictureBox)x).Bounds.IntersectsWith(char1.player.Bounds))
                 {
                     this.char1.Hp -= 1;
                 }
             }
         }
     }
     else if (char1.Hp == 0)
     {
         char1.player.Image = chardeath;
         gameover           = true;
     }
     if (Hero1 == true)
     {
         h1 = this.char1.Hp;
         Char1HPbar.Value = this.char1.Hp;
     }
     else if (Hero2 == true)
     {
         h2 = this.char1.Hp;
         Char3HPbar.Value = this.char1.Hp;
     }
     else if (Hero3 == true)
     {
         h3 = this.char1.Hp;
         Char2HPbar.Value = this.char1.Hp;
     }
 }