pub struct ResourcePool {
pub kind: ResourceType,
pub current: f32,
pub maximum: f32,
pub regen: f32,
pub decay: f32,
}Fields§
§kind: ResourceType§current: f32§maximum: f32§regen: f32§decay: f32Implementations§
Source§impl ResourcePool
impl ResourcePool
pub fn new(kind: ResourceType, max: f32) -> Self
pub fn update(&mut self, dt: f32, in_combat: bool)
pub fn spend(&mut self, amount: f32) -> bool
pub fn restore(&mut self, amount: f32)
pub fn fill(&mut self)
pub fn empty(&mut self)
pub fn percent(&self) -> f32
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
Trait Implementations§
Source§impl Clone for ResourcePool
impl Clone for ResourcePool
Source§fn clone(&self) -> ResourcePool
fn clone(&self) -> ResourcePool
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl Freeze for ResourcePool
impl RefUnwindSafe for ResourcePool
impl Send for ResourcePool
impl Sync for ResourcePool
impl Unpin for ResourcePool
impl UnsafeUnpin for ResourcePool
impl UnwindSafe for ResourcePool
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more