pub struct AchievementSystem {
pub achievements: Vec<Achievement>,
pub unlocked: HashSet<AchievementId>,
pub progress: HashMap<AchievementId, AchievementProgress>,
pub total_points: u32,
pub kill_counts: HashMap<String, u64>,
pub total_kills: u64,
pub quests_completed: u32,
pub gold_accumulated: u64,
}Fields§
§achievements: Vec<Achievement>§unlocked: HashSet<AchievementId>§progress: HashMap<AchievementId, AchievementProgress>§total_points: u32§kill_counts: HashMap<String, u64>§total_kills: u64§quests_completed: u32§gold_accumulated: u64Implementations§
Source§impl AchievementSystem
impl AchievementSystem
pub fn new() -> Self
pub fn register(&mut self, achievement: Achievement)
pub fn is_unlocked(&self, id: AchievementId) -> bool
pub fn unlock(&mut self, id: AchievementId) -> bool
pub fn record_kill(&mut self, enemy_type: &str) -> Vec<AchievementId>
pub fn record_quest_complete(&mut self) -> Vec<AchievementId>
pub fn record_gold(&mut self, amount: u64) -> Vec<AchievementId>
pub fn check_level(&mut self, level: u32) -> Vec<AchievementId>
pub fn manual_unlock(&mut self, id: AchievementId) -> bool
pub fn unlocked_count(&self) -> usize
pub fn total_achievement_count(&self) -> usize
pub fn completion_fraction(&self) -> f32
pub fn by_category(&self, cat: AchievementCategory) -> Vec<&Achievement>
pub fn recently_unlocked(&self, count: usize) -> Vec<&Achievement>
Trait Implementations§
Source§impl Clone for AchievementSystem
impl Clone for AchievementSystem
Source§fn clone(&self) -> AchievementSystem
fn clone(&self) -> AchievementSystem
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 moreSource§impl Debug for AchievementSystem
impl Debug for AchievementSystem
Source§impl Default for AchievementSystem
impl Default for AchievementSystem
Source§fn default() -> AchievementSystem
fn default() -> AchievementSystem
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for AchievementSystem
impl RefUnwindSafe for AchievementSystem
impl Send for AchievementSystem
impl Sync for AchievementSystem
impl Unpin for AchievementSystem
impl UnsafeUnpin for AchievementSystem
impl UnwindSafe for AchievementSystem
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.