Advertisement
Guest User

Untitled

a guest
Jul 15th, 2019
163
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.     // ToDo - Make this code less ugly and more optimal. Moving the boss healthbar to a widget may help
  2.     if( bTrackDamageHistory )
  3.     {
  4.         GUIStyle.DrawRoundedBoxEx(BorderScale, X, Y, W * HealthFrac, H, BarColor, false, !HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory, false, !HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory);
  5.        
  6.         if( DamageHistoryNum >= HealthBarDamageHistory.Length )
  7.             HealthBarDamageHistory.Length = DamageHistoryNum+1;
  8.            
  9.         if( HealthBarDamageHistory[DamageHistoryNum].OldBarHealth != Health )
  10.         {
  11.             if( HealthBarDamageHistory[DamageHistoryNum].OldBarHealth > Health )
  12.             {
  13.                 HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory = true;
  14.                
  15.                 if( HealthBarDamageHistory[DamageHistoryNum].OldHealth != Health )
  16.                 {
  17.                     HealthBarDamageHistory[DamageHistoryNum].OldHealth = Health;
  18.                     HealthBarDamageHistory[DamageHistoryNum].LastHealthUpdate = WorldInfo.RealTimeSeconds + 0.1f;
  19.                     HealthBarDamageHistory[DamageHistoryNum].HealthUpdateEndTime = WorldInfo.RealTimeSeconds + 0.925f;
  20.                 }
  21.                
  22.                 HistoryX = X + (W * HealthFrac);
  23.                 HealthFrac = FMin(float(HealthBarDamageHistory[DamageHistoryNum].OldBarHealth-Health) / float(HealthMax),1.f-HealthFrac);
  24.                
  25.                 FadeColor = WhiteColor;
  26.                 FadeColor.A  = BarColor.A;
  27.                 if( HealthBarDamageHistory[DamageHistoryNum].LastHealthUpdate < WorldInfo.RealTimeSeconds )
  28.                 {
  29.                     FadeColor.A = Clamp(Sin(WorldInfo.RealTimeSeconds * 12) * 200 + 255, 0, BarColor.A);
  30.                    
  31.                     if( HealthBarDamageHistory[DamageHistoryNum].HealthUpdateEndTime < WorldInfo.RealTimeSeconds )
  32.                     {
  33.                         HealthBarDamageHistory[DamageHistoryNum].OldBarHealth = Health;
  34.                         HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory = false;
  35.                         HealthBarDamageHistory[DamageHistoryNum].LastHealthUpdate = 0.f;
  36.                         HealthBarDamageHistory[DamageHistoryNum].HealthUpdateEndTime = 0.f;
  37.                     }
  38.                 }
  39.                
  40.                 GUIStyle.DrawRoundedBoxEx(ScaledBorderSize*2, HistoryX, Y, W * HealthFrac, H, FadeColor, false, true, false, true);
  41.             }
  42.             else
  43.             {
  44.                 HealthBarDamageHistory[DamageHistoryNum].OldBarHealth = Health;
  45.             }
  46.         }
  47.        
  48.         DamageHistoryNum++;
  49.     }
  50.     else GUIStyle.DrawRoundedBoxEx(BorderScale, X, Y, W * HealthFrac, H, BarColor, false, true, false, true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement