Colour changes by poise state

This commit is contained in:
kitswas 2022-09-02 11:54:47 +05:30
parent 6b2a41ade7
commit 6ff5f540bf
2 changed files with 11 additions and 3 deletions

View File

@ -145,7 +145,7 @@ const CRITICAL_HP_COLOR: Color = Color::Rgba(0.79, 0.19, 0.17, 1.0);
const STAMINA_COLOR: Color = Color::Rgba(0.29, 0.62, 0.75, 0.9); const STAMINA_COLOR: Color = Color::Rgba(0.29, 0.62, 0.75, 0.9);
const ENEMY_HP_COLOR: Color = Color::Rgba(0.93, 0.1, 0.29, 1.0); const ENEMY_HP_COLOR: Color = Color::Rgba(0.93, 0.1, 0.29, 1.0);
const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0); const XP_COLOR: Color = Color::Rgba(0.59, 0.41, 0.67, 1.0);
const POISE_COLOR: Color = Color::Rgba(0.70, 0.0, 0.50, 1.0); const POISE_COLOR: Color = Color::Rgba(0.70, 0.0, 0.60, 1.0);
const POISEBAR_TICK_COLOR: Color = Color::Rgba(0.70, 0.90, 0.0, 1.0); const POISEBAR_TICK_COLOR: Color = Color::Rgba(0.70, 0.90, 0.0, 1.0);
//const TRANSPARENT: Color = Color::Rgba(0.0, 0.0, 0.0, 0.0); //const TRANSPARENT: Color = Color::Rgba(0.0, 0.0, 0.0, 0.0);
//const FOCUS_COLOR: Color = Color::Rgba(1.0, 0.56, 0.04, 1.0); //const FOCUS_COLOR: Color = Color::Rgba(1.0, 0.56, 0.04, 1.0);

View File

@ -25,7 +25,7 @@ use common::comp::{
self, self,
ability::AbilityInput, ability::AbilityInput,
item::{ItemDesc, MaterialStatManifest}, item::{ItemDesc, MaterialStatManifest},
Ability, ActiveAbilities, Body, Energy, Health, Inventory, Poise, SkillSet, Ability, ActiveAbilities, Body, Energy, Health, Inventory, Poise, PoiseState, SkillSet,
}; };
use conrod_core::{ use conrod_core::{
color, color,
@ -482,6 +482,14 @@ impl<'a> Skillbar<'a> {
state.ids.poise_tick_4, state.ids.poise_tick_4,
]; ];
let poise_colour = match self.poise.poise_state() {
self::PoiseState::KnockedDown => BLACK,
self::PoiseState::Dazed => Color::Rgba(0.25, 0.0, 0.15, 1.0),
self::PoiseState::Stunned => Color::Rgba(0.40, 0.0, 0.30, 1.0),
self::PoiseState::Interrupted => Color::Rgba(0.55, 0.0, 0.45, 1.0),
_ => POISE_COLOR,
};
Image::new(self.imgs.poise_bg) Image::new(self.imgs.poise_bg)
.w_h(323.0, 14.0) .w_h(323.0, 14.0)
.mid_top_with_margin_on(state.ids.frame, -offset) .mid_top_with_margin_on(state.ids.frame, -offset)
@ -491,7 +499,7 @@ impl<'a> Skillbar<'a> {
.set(state.ids.poise_alignment, ui); .set(state.ids.poise_alignment, ui);
Image::new(self.imgs.bar_content) Image::new(self.imgs.bar_content)
.w_h(319.0 * poise_percentage / 100.0, 10.0) .w_h(319.0 * poise_percentage / 100.0, 10.0)
.color(Some(POISE_COLOR)) .color(Some(poise_colour))
.top_left_with_margins_on(state.ids.poise_alignment, 0.0, 0.0) .top_left_with_margins_on(state.ids.poise_alignment, 0.0, 0.0)
.set(state.ids.poise_filling, ui); .set(state.ids.poise_filling, ui);
for (i, threshold) in self::Poise::POISE_THRESHOLDS.iter().enumerate() { for (i, threshold) in self::Poise::POISE_THRESHOLDS.iter().enumerate() {