Example #1
0
        private void RefreshHUD(PlayerHealth playerHp)
        {
            long life = playerHp.Health;
            long maxlife = playerHp.MaxHealth;

            if (maxlife == 0) {
                life = 1;
                maxlife = 1;
            }

            try
            {
                this.Invoke((MethodInvoker)delegate {
                    RefreshHUD(life, maxlife);
                });
            }
            catch
            {
            }
        }
Example #2
0
 private void UpdateHealth(PlayerHealth playerHealth)
 {
     health = (float)playerHealth.Health / playerHealth.MaxHealth;
     this.Invalidate();
 }
Example #3
0
        private void RefreshHealth(PlayerHealth playerHp)
        {
            lifePercentage = (float)playerHp.Health / playerHp.MaxHealth;

            try
            {
                this.Invoke((MethodInvoker)delegate {
                    RefreshHUD();
                });
            }
            catch { }
        }
Example #4
0
        private static void UpdateHealth()
        {
            bool attributesChanged = ReadHealth();
            attributesChanged |= ReadMaxHealth();

            if (attributesChanged) {

                if (SettingsManager.getSettingBool("AutoScreenshotLowLife")) {
                    if (health < maxHealth / 10 && health > 0 && maxHealth > health) {
                        lock (screenshotLock) {
                            if (!screenshotTaken) {
                                ScreenshotManager.saveScreenshot("LowLife", ScreenshotManager.takeScreenshot());
                                screenshotTaken = true;
                                screenshotTimer.Start();
                            }
                        }
                    }
                }

                if (HealthChanged != null) {
                    var playerHealth = new PlayerHealth {
                        Health = health,
                        MaxHealth = maxHealth
                    };
                    HealthChanged(null, playerHealth);
                }
            }
        }