Enum ai_behavior::State [] [src]

pub enum State<A, S> {
    PressedState(Button),
    ReleasedState(Button),
    ActionState(A, Option<S>),
    FailState(Box<State<A, S>>),
    AlwaysSucceedState(Box<State<A, S>>),
    WaitState(f64f64),
    WaitForeverState,
    IfState(Box<Behavior<A>>, Box<Behavior<A>>, StatusBox<State<A, S>>),
    SelectState(Vec<Behavior<A>>, usizeBox<State<A, S>>),
    SequenceState(Vec<Behavior<A>>, usizeBox<State<A, S>>),
    WhileState(Box<State<A, S>>, Vec<Behavior<A>>, usizeBox<State<A, S>>),
    WhenAllState(Vec<Option<State<A, S>>>),
    WhenAnyState(Vec<Option<State<A, S>>>),
    AfterState(usizeVec<State<A, S>>),
}

Keeps track of a behavior.

Variants

Returns Success when button is pressed.

Returns Success when button is released.

Executes an action.

Converts Success into Failure and vice versa.

Ignores failures and always return Success.

Keeps track of waiting for a period of time before continuing.

f64: Total time in seconds to wait

f64: Time elapsed in seconds

Waits forever.

Keeps track of an If behavior. If status is Running, then it evaluates the condition. If status is Success, then it evaluates the success behavior. If status is Failure, then it evaluates the failure behavior.

Keeps track of a Select behavior.

Keeps track of an Sequence behavior.

Keeps track of a While behavior.

Keeps track of a WhenAll behavior.

Keeps track of a WhenAny behavior.

Keeps track of an After behavior.

Methods

impl<A: Clone, S> State<A, S>
[src]

Creates a state from a behavior.

Updates the cursor that tracks an event.

The action need to return status and remaining delta time. Returns status and the remaining delta time.

Passes event, delta time in seconds, action and state to closure. The closure should return a status and remaining delta time.

Trait Implementations

impl<A: Clone, S: Clone> Clone for State<A, S>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<A: Decodable, S: Decodable> Decodable for State<A, S>
[src]

Deserialize a value using a Decoder.

impl<A: Encodable, S: Encodable> Encodable for State<A, S>
[src]

Serialize a value using an Encoder.

impl<A: PartialEq, S: PartialEq> PartialEq for State<A, S>
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.