Animation for cast aura, combo information passed to skillbar.

This commit is contained in:
Sam 2021-03-03 15:34:42 -05:00
parent b6f4543a14
commit c5f74e528d
4 changed files with 37 additions and 2 deletions

View File

@ -36,7 +36,7 @@ impl Animation for ShockwaveAnimation {
let (move1, move2, move3) = match stage_section {
Some(StageSection::Buildup) => (anim_time, 0.0, 0.0),
Some(StageSection::Swing) => (1.0, anim_time, 0.0),
Some(StageSection::Swing) | Some(StageSection::Cast) => (1.0, anim_time, 0.0),
Some(StageSection::Recover) => (1.0, 1.0, anim_time),
_ => (0.0, 0.0, 0.0),
};

View File

@ -2158,6 +2158,7 @@ impl Hud {
let controllers = ecs.read_storage::<comp::Controller>();
let ability_map = ecs.fetch::<comp::item::tool::AbilityMap>();
let bodies = ecs.read_storage::<comp::Body>();
let combos = ecs.read_storage::<comp::Combo>();
if let (
Some(health),
@ -2165,12 +2166,14 @@ impl Hud {
Some(energy),
Some(_character_state),
Some(_controller),
Some(combo),
) = (
healths.get(entity),
inventories.get(entity),
energies.get(entity),
character_states.get(entity),
controllers.get(entity).map(|c| &c.inputs),
combos.get(entity),
) {
Skillbar::new(
global_state,
@ -2190,6 +2193,7 @@ impl Hud {
i18n,
&ability_map,
&msm,
&combo,
)
.set(self.ids.skillbar, ui_widgets);
}

View File

@ -21,7 +21,7 @@ use common::comp::{
tool::{AbilityMap, Tool, ToolKind},
Hands, Item, ItemKind, MaterialStatManifest,
},
Energy, Health, Inventory,
Combo, Energy, Health, Inventory,
};
use conrod_core::{
color,
@ -141,6 +141,7 @@ pub struct Skillbar<'a> {
common: widget::CommonBuilder,
ability_map: &'a AbilityMap,
msm: &'a MaterialStatManifest,
combo: &'a Combo,
}
impl<'a> Skillbar<'a> {
@ -163,6 +164,7 @@ impl<'a> Skillbar<'a> {
localized_strings: &'a Localization,
ability_map: &'a AbilityMap,
msm: &'a MaterialStatManifest,
combo: &'a Combo,
) -> Self {
Self {
global_state,
@ -183,6 +185,7 @@ impl<'a> Skillbar<'a> {
localized_strings,
ability_map,
msm,
combo,
}
}
}

View File

@ -1099,6 +1099,34 @@ impl FigureMgr {
skeleton_attr,
)
},
CharacterState::CastAura(s) => {
let stage_time = s.timer.as_secs_f32();
let stage_progress = match s.stage_section {
StageSection::Buildup => {
stage_time / s.static_data.buildup_duration.as_secs_f32()
},
StageSection::Cast => {
stage_time / s.static_data.cast_duration.as_secs_f32()
},
StageSection::Recover => {
stage_time / s.static_data.recover_duration.as_secs_f32()
},
_ => 0.0,
};
anim::character::ShockwaveAnimation::update_skeleton(
&target_base,
(
active_tool_kind,
second_tool_kind,
time,
vel.0.magnitude(),
Some(s.stage_section),
),
stage_progress,
&mut state_animation_rate,
skeleton_attr,
)
},
CharacterState::LeapMelee(s) => {
let stage_progress = match active_tool_kind {
Some(ToolKind::Axe | ToolKind::Hammer) => {