pub enum StateAction<T: EntityId> {
None,
RewindAnimation(Handle<Animation<T>>),
EnableAnimation(Handle<Animation<T>>),
DisableAnimation(Handle<Animation<T>>),
EnableRandomAnimation(Vec<Handle<Animation<T>>>),
}Expand description
An action, that will be executed by a state. It usually used to rewind, enable/disable animations
when entering or leaving states. This is useful in situations when you have a one-shot animation
and you need to rewind it before when entering some state. For example, you may have looped idle
state and one-shot attack state. In this case, you need to use StateAction::RewindAnimation
to tell the engine to automatically rewind the animation before using it. Otherwise, when the
transition will happen, the animation could be ended already and you’ll get “frozen” animation.
Variants§
None
No action.
RewindAnimation(Handle<Animation<T>>)
Rewinds the animation.
EnableAnimation(Handle<Animation<T>>)
Enables the animation.
DisableAnimation(Handle<Animation<T>>)
Disables the animation.
EnableRandomAnimation(Vec<Handle<Animation<T>>>)
Enables random animation from the list. It could be useful if you want to add randomization to your state machine. For example, you may have few melee attack animations and all of them are suitable for every situation, in this case you can add randomization to make attacks less predictable.
Implementations§
Source§impl<T: EntityId> StateAction<T>
impl<T: EntityId> StateAction<T>
pub const REWIND_ANIMATION_F_0: &'static str = "RewindAnimation@0"
pub const ENABLE_ANIMATION_F_0: &'static str = "EnableAnimation@0"
pub const DISABLE_ANIMATION_F_0: &'static str = "DisableAnimation@0"
pub const ENABLE_RANDOM_ANIMATION_F_0: &'static str = "EnableRandomAnimation@0"
Source§impl<T: EntityId> StateAction<T>
impl<T: EntityId> StateAction<T>
Sourcepub fn apply(&self, animations: &mut AnimationContainer<T>)
pub fn apply(&self, animations: &mut AnimationContainer<T>)
Applies the action to the given animation container.
Trait Implementations§
Source§impl<T: Clone + EntityId> Clone for StateAction<T>
impl<T: Clone + EntityId> Clone for StateAction<T>
Source§fn clone(&self) -> StateAction<T>
fn clone(&self) -> StateAction<T>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T: EntityId> Default for StateAction<T>
impl<T: EntityId> Default for StateAction<T>
Source§fn default() -> StateAction<T>
fn default() -> StateAction<T>
Source§impl<T: EntityId> FromStr for StateAction<T>
impl<T: EntityId> FromStr for StateAction<T>
Source§impl<T: PartialEq + EntityId> PartialEq for StateAction<T>
impl<T: PartialEq + EntityId> PartialEq for StateAction<T>
Source§fn eq(&self, other: &StateAction<T>) -> bool
fn eq(&self, other: &StateAction<T>) -> bool
self and other values to be equal, and is used by ==.Source§impl<T: EntityId> Reflect for StateAction<T>where
Self: 'static,
impl<T: EntityId> Reflect for StateAction<T>where
Self: 'static,
fn source_path() -> &'static str
fn try_clone_box(&self) -> Option<Box<dyn Reflect>>
fn type_name(&self) -> &'static str
fn derived_types() -> &'static [TypeId]
fn query_derived_types(&self) -> &'static [TypeId]
fn doc(&self) -> &'static str
Source§fn assembly_name(&self) -> &'static str
fn assembly_name(&self) -> &'static str
#[derive(Reflect)]) to ensure that this method will return correct assembly
name. In other words - there’s no guarantee, that any implementation other than proc-macro
will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME")
as an implementation.Source§fn type_assembly_name() -> &'static str
fn type_assembly_name() -> &'static str
#[derive(Reflect)]) to ensure that this method will return correct assembly
name. In other words - there’s no guarantee, that any implementation other than proc-macro
will return a correct name of the assembly. Alternatively, you can use env!("CARGO_PKG_NAME")
as an implementation.fn fields_ref(&self, func: &mut dyn FnMut(&[FieldRef<'_, '_>]))
fn fields_mut(&mut self, func: &mut dyn FnMut(&mut [FieldMut<'_, '_>]))
fn into_any(self: Box<Self>) -> Box<dyn Any>
fn set( &mut self, value: Box<dyn Reflect>, ) -> Result<Box<dyn Reflect>, Box<dyn Reflect>>
fn as_any(&self, func: &mut dyn FnMut(&dyn Any))
fn as_any_mut(&mut self, func: &mut dyn FnMut(&mut dyn Any))
fn as_reflect(&self, func: &mut dyn FnMut(&dyn Reflect))
fn as_reflect_mut(&mut self, func: &mut dyn FnMut(&mut dyn Reflect))
Source§fn set_field(
&mut self,
field_name: &str,
value: Box<dyn Reflect>,
func: &mut dyn FnMut(Result<Box<dyn Reflect>, SetFieldError>),
)
fn set_field( &mut self, field_name: &str, value: Box<dyn Reflect>, func: &mut dyn FnMut(Result<Box<dyn Reflect>, SetFieldError>), )
#[reflect(setter = ..)] or falls back to
Reflect::field_mutfn field( &self, name: &str, func: &mut dyn FnMut(Option<&(dyn Reflect + 'static)>), )
fn field_mut( &mut self, name: &str, func: &mut dyn FnMut(Option<&mut (dyn Reflect + 'static)>), )
fn as_array(&self, func: &mut dyn FnMut(Option<&(dyn ReflectArray + 'static)>))
fn as_array_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectArray + 'static)>), )
fn as_list(&self, func: &mut dyn FnMut(Option<&(dyn ReflectList + 'static)>))
fn as_list_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectList + 'static)>), )
fn as_inheritable_variable( &self, func: &mut dyn FnMut(Option<&(dyn ReflectInheritableVariable + 'static)>), )
fn as_inheritable_variable_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectInheritableVariable + 'static)>), )
fn as_hash_map( &self, func: &mut dyn FnMut(Option<&(dyn ReflectHashMap + 'static)>), )
fn as_hash_map_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectHashMap + 'static)>), )
fn as_handle( &self, func: &mut dyn FnMut(Option<&(dyn ReflectHandle + 'static)>), )
fn as_handle_mut( &mut self, func: &mut dyn FnMut(Option<&mut (dyn ReflectHandle + 'static)>), )
impl<T: PartialEq + EntityId> StructuralPartialEq for StateAction<T>
Source§impl<T: EntityId> TypeUuidProvider for StateAction<T>
impl<T: EntityId> TypeUuidProvider for StateAction<T>
Source§impl<T: EntityId> VariantNames for StateAction<T>
impl<T: EntityId> VariantNames for StateAction<T>
Source§impl<T: EntityId> Visit for StateAction<T>
impl<T: EntityId> Visit for StateAction<T>
Source§fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult
fn visit(&mut self, name: &str, visitor: &mut Visitor) -> VisitResult
Auto Trait Implementations§
impl<T> !RefUnwindSafe for StateAction<T>
impl<T> !UnwindSafe for StateAction<T>
impl<T> Freeze for StateAction<T>
impl<T> Send for StateAction<T>
impl<T> Sync for StateAction<T>
impl<T> Unpin for StateAction<T>where
T: Unpin,
impl<T> UnsafeUnpin for StateAction<T>
Blanket Implementations§
Source§impl<T> AsyncTaskResult for T
impl<T> AsyncTaskResult for T
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> FieldValue for Twhere
T: Reflect,
impl<T> FieldValue for Twhere
T: Reflect,
Source§fn field_value_as_any_ref(&self) -> &(dyn Any + 'static)
fn field_value_as_any_ref(&self) -> &(dyn Any + 'static)
self to a &dyn AnySource§fn field_value_as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn field_value_as_any_mut(&mut self) -> &mut (dyn Any + 'static)
self to a &mut dyn Anyfn field_value_as_reflect(&self) -> &(dyn Reflect + 'static)
fn field_value_as_reflect_mut(&mut self) -> &mut (dyn Reflect + 'static)
fn type_name(&self) -> &'static str
Source§impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
impl<T, U> ObjectOrVariant<T> for Uwhere
PhantomData<U>: ObjectOrVariantHelper<T, U>,
Source§impl<T> ReflectBase for Twhere
T: Reflect,
impl<T> ReflectBase for Twhere
T: Reflect,
fn as_any_raw(&self) -> &(dyn Any + 'static)
fn as_any_raw_mut(&mut self) -> &mut (dyn Any + 'static)
Source§impl<T> ResolvePath for Twhere
T: Reflect,
impl<T> ResolvePath for Twhere
T: Reflect,
fn resolve_path<'p>( &self, path: &'p str, func: &mut dyn FnMut(Result<&(dyn Reflect + 'static), ReflectPathError<'p>>), )
fn resolve_path_mut<'p>( &mut self, path: &'p str, func: &mut dyn FnMut(Result<&mut (dyn Reflect + 'static), ReflectPathError<'p>>), )
fn get_resolve_path<'p, T>(
&self,
path: &'p str,
func: &mut dyn FnMut(Result<&T, ReflectPathError<'p>>),
)where
T: Reflect,
fn get_resolve_path_mut<'p, T>(
&mut self,
path: &'p str,
func: &mut dyn FnMut(Result<&mut T, ReflectPathError<'p>>),
)where
T: Reflect,
impl<T> Scalar for T
impl<T> SpriteSheetTexture for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.