~starkingdoms/starkingdoms

ref: e2c74ff0a4af609afb2869c59835838dd76f639c starkingdoms/crates/unified/src/particle_editor/ecs.rs -rw-r--r-- 928 bytes
e2c74ff0 — core Revert "aaa ??? ?? ? ?? ???????????????????????????????????????????? i would like to explosion" 10 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
use std::time::Duration;

use crate::particles::ParticleEffect;
use bevy::{
    asset::Handle,
    ecs::component::Component,
    time::{Timer, TimerMode},
};
use crate::prelude::*;

#[derive(Component)]
pub struct Particle;

#[derive(Component)]
pub struct LifetimeTimer(pub Timer);
impl LifetimeTimer {
    #[allow(dead_code, reason = "ghostly, what is this for?")]
    pub fn new(lifetime: f32) -> LifetimeTimer {
        LifetimeTimer(Timer::new(
            Duration::from_secs_f32(lifetime),
            TimerMode::Once,
        ))
    }
}

#[derive(Component)]
pub struct SpawnDelayTimer(pub Timer);
impl SpawnDelayTimer {
    pub fn new(delay: f32) -> SpawnDelayTimer {
        SpawnDelayTimer(Timer::new(Duration::from_secs_f32(delay), TimerMode::Once))
    }
}

#[derive(Component)]
pub struct CircleMesh(pub Handle<Mesh>, pub Handle<ColorMaterial>);

#[derive(Component)]
pub struct ParentEffect(pub ParticleEffect);