pub enum BehaviorNode {
Show 16 variants
If {
cond: BehaviorExpr,
then: Vec<BehaviorNode>,
otherwise: Vec<BehaviorNode>,
},
ForEach {
query: String,
bind: String,
body: Vec<BehaviorNode>,
},
Let {
name: String,
value: BehaviorExpr,
},
Set {
var: String,
value: BehaviorExpr,
add: bool,
},
SetLocal {
local: String,
value: BehaviorExpr,
add: bool,
},
SetTransform {
entity: BehaviorExpr,
position: Option<BehaviorExpr>,
rotation_deg: Option<BehaviorExpr>,
scale: Option<BehaviorExpr>,
},
Spawn {
template: Option<AssetId>,
position: [f32; 3],
rotation_deg: [f32; 3],
scale: [f32; 3],
lifetime: f32,
bind: Option<String>,
},
Despawn {
target: BehaviorExpr,
},
Reparent {
child: BehaviorExpr,
parent: Option<BehaviorExpr>,
},
Show {
target: BehaviorExpr,
},
Hide {
target: BehaviorExpr,
},
Sound {
clip: Option<AudioClipHandle>,
kind: CueKind,
volume: f32,
},
Scene {
scene: Option<AssetId>,
transition: String,
},
Screen {
screen: Option<AssetId>,
},
Story(StoryPlayback),
Save,
}Expand description
One node run by a firing Behavior.
Nodes are the only way a behavior changes the world. There is no unbounded loop and no recursion, so a behavior body always terminates.
Variants§
If
Runs then when cond holds, else otherwise.
Fields
cond: BehaviorExprThe tested expression.
then: Vec<BehaviorNode>Nodes run when cond holds.
otherwise: Vec<BehaviorNode>Nodes run when cond does not hold.
ForEach
Runs do once per entity a declared query matched, binding each to
bind.
Fields
body: Vec<BehaviorNode>Nodes run per entity.
Let
Binds an expression to a name for the rest of the body.
Set
Writes a world variable: assign value, or add it to the current value
when add is true.
Fields
value: BehaviorExprThe value assigned (or added).
SetLocal
Writes one of this behavior’s per-entity locals.
Fields
value: BehaviorExprThe value assigned (or added).
SetTransform
Writes an entity’s transform. An omitted field is left unchanged.
Fields
entity: BehaviorExprThe entity moved.
position: Option<BehaviorExpr>New world-space position.
rotation_deg: Option<BehaviorExpr>New Euler rotation in degrees.
scale: Option<BehaviorExpr>New scale.
Spawn
Creates a copy of an existing placement at a world position. Binding
bind makes the copy addressable for the rest of the body.
Fields
Despawn
Removes an entity and its children from the world.
Fields
target: BehaviorExprThe entity removed.
Reparent
Re-points an entity’s parent edge.
Fields
child: BehaviorExprThe entity moved.
parent: Option<BehaviorExpr>The new parent, or unset to detach to a root.
Show
Makes a hidden entity (and its children) visible again.
Fields
target: BehaviorExprThe entity revealed.
Hide
Makes an entity (and its children) invisible without removing it. A
hidden entity keeps simulating; show reverses this.
Fields
target: BehaviorExprThe entity hidden.
Sound
Plays an AudioClip flat on the main mix (no 3D position).
Fields
clip: Option<AudioClipHandle>The clip played.
Scene
Jumps the world to a named Scene.
Fields
Screen
Shows a Screen, replacing the top of the screen stack.
Story(StoryPlayback)
Controls the world’s Story playback.
Save
Writes the world’s logic state to disk: every world variable, plus
which once behaviors have fired. Per-entity locals are not saved. The
state is restored the next time the world starts, so a behavior gated
on a saved variable carries across runs. Timers, delays, and cooldowns
restart fresh; entities are not saved. A world with no save node
never reads or writes state.
Trait Implementations§
Source§impl Clone for BehaviorNode
impl Clone for BehaviorNode
Source§fn clone(&self) -> BehaviorNode
fn clone(&self) -> BehaviorNode
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for BehaviorNode
impl Debug for BehaviorNode
Source§impl<'de> Deserialize<'de> for BehaviorNode
impl<'de> Deserialize<'de> for BehaviorNode
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<BehaviorNode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<BehaviorNode, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Serialize for BehaviorNode
impl Serialize for BehaviorNode
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
Auto Trait Implementations§
impl Freeze for BehaviorNode
impl RefUnwindSafe for BehaviorNode
impl Send for BehaviorNode
impl Sync for BehaviorNode
impl Unpin for BehaviorNode
impl UnsafeUnpin for BehaviorNode
impl UnwindSafe for BehaviorNode
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
impl<S, T> Duplex<S> for Twhere
T: FromSample<S> + ToSample<S>,
Source§impl<S> FromSample<S> for S
impl<S> FromSample<S> for S
fn from_sample_(s: S) -> S
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
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> ⓘ
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> ⓘ
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