bevy_gauge 0.2.2

bevy_gauge - a flexible stats system for Bevy
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use bevy::ecs::entity::Entity;

use crate::prelude::{StatsMutator, Stats};

pub trait StatDerived {
    fn should_update(&self, stats: &Stats) -> bool;

    fn update_from_stats(&mut self, stats: &Stats);
}

pub trait WriteBack {
    fn write_back(&self, target_entity: Entity, stats_mutator: &mut StatsMutator);
    
    /// Returns true if this component should write back to stats.
    /// This should only return true if the writeback-specific fields have actually changed
    /// from what's currently stored in the stats system.
    fn should_write_back(&self, target_entity: Entity, stats_mutator: &StatsMutator) -> bool;
}