Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use bevy_ecs::prelude::*;
use bevy_reflect::Reflect;
use wasvy::WasvyComponent;

#[derive(Component, Reflect, Default, WasvyComponent)]
#[reflect(Component)]
pub struct Health {
    current: f32,
    max: f32,
}

#[wasvy::methods]
impl Health {
    fn pct(&self) -> f32 {
        self.current / self.max
    }
}