use std::fmt::Debug;
use bevy::prelude::*;
use dyn_clone::DynClone;
use crate::prelude::*;
use crate::sickle::*;
pub trait StaticAttribute: Instruction
{
type Value: Loadable + Clone + DynClone + Debug;
fn construct(value: Self::Value) -> Self;
#[inline(always)]
fn update(entity: Entity, world: &mut World, new_value: Self::Value)
{
Self::construct(new_value).apply(entity, world);
world.flush();
}
}
pub trait ResponsiveAttribute: StaticAttribute
{
#[inline(always)]
fn extract(
_: Entity,
_: &mut World,
reference_vals: &ResponsiveVals<Self::Value>,
state: FluxInteraction,
) -> Self::Value
{
reference_vals.to_value(state)
}
}
pub trait AnimatedAttribute: StaticAttribute<Value: Lerp>
{
fn get_value(entity: Entity, world: &World) -> Option<Self::Value>;
#[inline(always)]
fn extract(
_: Entity,
_: &mut World,
reference_vals: &AnimatedVals<Self::Value>,
state: &AnimationState,
) -> Self::Value
{
reference_vals.to_value(state)
}
}