pub struct MotionGraph {
pub entry_state: Option<String>,
/* private fields */
}Expand description
Animation state machine – a collection of states connected by transitions.
Fields§
§entry_state: Option<String>Name of the state to enter on startup.
Implementations§
Source§impl MotionGraph
impl MotionGraph
Sourcepub fn add_state(&mut self, state: MotionState)
pub fn add_state(&mut self, state: MotionState)
Register a state. If this is the first state and no entry state has been set, it becomes the entry state automatically.
Sourcepub fn add_transition(&mut self, transition: MotionTransition)
pub fn add_transition(&mut self, transition: MotionTransition)
Register a transition edge.
Sourcepub fn state_count(&self) -> usize
pub fn state_count(&self) -> usize
Total number of registered states.
Sourcepub fn transition_count(&self) -> usize
pub fn transition_count(&self) -> usize
Total number of registered transitions.
Sourcepub fn get_state(&self, name: &str) -> Option<&MotionState>
pub fn get_state(&self, name: &str) -> Option<&MotionState>
Look up a state by name.
Sourcepub fn transitions_from(&self, state: &str) -> Vec<&MotionTransition>
pub fn transitions_from(&self, state: &str) -> Vec<&MotionTransition>
Return all transitions whose from_state matches state, sorted by
descending priority so that callers evaluate highest-priority first.
Sourcepub fn default_graph() -> Self
pub fn default_graph() -> Self
Build the canonical idle / walk / run locomotion graph.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for MotionGraph
impl RefUnwindSafe for MotionGraph
impl Send for MotionGraph
impl Sync for MotionGraph
impl Unpin for MotionGraph
impl UnsafeUnpin for MotionGraph
impl UnwindSafe for MotionGraph
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more