Add Constant for damage fade

Former-commit-id: 4b0e2ff6249ebcf814b036ba11c57ad094811e30
This commit is contained in:
timokoesters 2019-05-25 13:35:37 +02:00
parent 73f29e3716
commit 525af4c201

View File

@ -30,6 +30,8 @@ use specs::{Component, Entity as EcsEntity, Join, VecStorage};
use std::{collections::HashMap, f32}; use std::{collections::HashMap, f32};
use vek::*; use vek::*;
const DAMAGE_FADE_COEFFICIENT: f64 = 5.0;
pub struct FigureModelCache { pub struct FigureModelCache {
models: HashMap<Body, (Model<FigurePipeline>, u64)>, models: HashMap<Body, (Model<FigurePipeline>, u64)>,
} }
@ -364,7 +366,7 @@ impl FigureMgr {
.and_then(|stats| stats.hp.last_change) .and_then(|stats| stats.hp.last_change)
.map(|(change_by, time)| { .map(|(change_by, time)| {
Rgba::broadcast(1.0) Rgba::broadcast(1.0)
+ Rgba::new(0.0, -1.0, -1.0, 0.0).map(|c| (c / (1.0 + 5.0 * time)) as f32) + Rgba::new(0.0, -1.0, -1.0, 0.0).map(|c| (c / (1.0 + DAMAGE_FADE_COEFFICIENT * time)) as f32)
}) })
.unwrap_or(Rgba::broadcast(1.0)); .unwrap_or(Rgba::broadcast(1.0));