Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // ToDo - Make this code less ugly and more optimal. Moving the boss healthbar to a widget may help
- if( bTrackDamageHistory )
- {
- GUIStyle.DrawRoundedBoxEx(BorderScale, X, Y, W * HealthFrac, H, BarColor, false, !HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory, false, !HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory);
- if( DamageHistoryNum >= HealthBarDamageHistory.Length )
- HealthBarDamageHistory.Length = DamageHistoryNum+1;
- if( HealthBarDamageHistory[DamageHistoryNum].OldBarHealth != Health )
- {
- if( HealthBarDamageHistory[DamageHistoryNum].OldBarHealth > Health )
- {
- HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory = true;
- if( HealthBarDamageHistory[DamageHistoryNum].OldHealth != Health )
- {
- HealthBarDamageHistory[DamageHistoryNum].OldHealth = Health;
- HealthBarDamageHistory[DamageHistoryNum].LastHealthUpdate = WorldInfo.RealTimeSeconds + 0.1f;
- HealthBarDamageHistory[DamageHistoryNum].HealthUpdateEndTime = WorldInfo.RealTimeSeconds + 0.925f;
- }
- HistoryX = X + (W * HealthFrac);
- HealthFrac = FMin(float(HealthBarDamageHistory[DamageHistoryNum].OldBarHealth-Health) / float(HealthMax),1.f-HealthFrac);
- FadeColor = WhiteColor;
- FadeColor.A = BarColor.A;
- if( HealthBarDamageHistory[DamageHistoryNum].LastHealthUpdate < WorldInfo.RealTimeSeconds )
- {
- FadeColor.A = Clamp(Sin(WorldInfo.RealTimeSeconds * 12) * 200 + 255, 0, BarColor.A);
- if( HealthBarDamageHistory[DamageHistoryNum].HealthUpdateEndTime < WorldInfo.RealTimeSeconds )
- {
- HealthBarDamageHistory[DamageHistoryNum].OldBarHealth = Health;
- HealthBarDamageHistory[DamageHistoryNum].bDrawingHistory = false;
- HealthBarDamageHistory[DamageHistoryNum].LastHealthUpdate = 0.f;
- HealthBarDamageHistory[DamageHistoryNum].HealthUpdateEndTime = 0.f;
- }
- }
- GUIStyle.DrawRoundedBoxEx(ScaledBorderSize*2, HistoryX, Y, W * HealthFrac, H, FadeColor, false, true, false, true);
- }
- else
- {
- HealthBarDamageHistory[DamageHistoryNum].OldBarHealth = Health;
- }
- }
- DamageHistoryNum++;
- }
- else GUIStyle.DrawRoundedBoxEx(BorderScale, X, Y, W * HealthFrac, H, BarColor, false, true, false, true);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement