~starkingdoms/starkingdoms

c286244e20a5c15a2e001b481016d1cb51c87d4a — ghostly_zsh 5 months ago 0ef10cc
more insanity
2 files changed, 8 insertions(+), 5 deletions(-)

M crates/unified/src/particle_editor/mod.rs
M crates/unified/src/particles.rs
M crates/unified/src/particle_editor/mod.rs => crates/unified/src/particle_editor/mod.rs +3 -1
@@ 34,7 34,9 @@ pub fn particle_editor_plugin(app: &mut App) {
    });
}

fn setup_editor_effect(mut commands: Commands) {
fn setup_editor_effect(
    mut commands: Commands,
) {
    commands.spawn((
        ParticleEffect {
            lifetime_seconds: RandF32 {

M crates/unified/src/particles.rs => crates/unified/src/particles.rs +5 -4
@@ 1,7 1,6 @@
use std::collections::BTreeMap;
use std::ops::Bound::{Included, Unbounded};
use bevy::color::{Color, LinearRgba};
use bevy::math::cubic_splines::LinearSpline;
use bevy::math::Vec2;
use bevy::prelude::Component;
use ordered_float::{FloatCore, OrderedFloat};


@@ 64,9 63,11 @@ impl<P: Lerp + Copy> LifetimeCurve<P> {
        Some(a_val.lerp(b_val, t))
    }

    pub fn clamp_time(&self,  time: f32) -> Option<f32> {
        let Some(first) = self.0.iter().nth(0) else { return None };
        let Some(last) = self.0.iter().last() else { return None };
    /// Given an input time value, use the ends of the spline's time to clamp
    /// the input value.
    pub fn clamp_time(&self, time: f32) -> Option<f32> {
        let Some(first) = self.0.iter().nth(0) else { return None; };
        let Some(last) = self.0.iter().last() else { return None; };

        Some(time.clamp(first.0.0, last.0.0))
    }