Skip to content

Commit

Permalink
Fix the example in TnuaAnimatingState's documentation.
Browse files Browse the repository at this point in the history
  • Loading branch information
idanarye committed Jul 5, 2024
1 parent e62d30b commit 7731be8
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions src/animating_helper.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@ use bevy::prelude::*;
/// # use bevy_tnua::{TnuaAnimatingState, TnuaAnimatingStateDirective};
/// # use bevy_tnua::math::Float;
/// # #[derive(Resource)]
/// # struct AnimationClips {
/// # standing: Handle<AnimationClip>,
/// # running: Handle<AnimationClip>,
/// # struct AnimationNodes {
/// # standing: AnimationNodeIndex,
/// # running: AnimationNodeIndex,
/// # }
/// enum AnimationState {
/// Standing,
Expand All @@ -33,7 +33,7 @@ use bevy::prelude::*;
/// &TnuaController,
/// &mut AnimationPlayer,
/// )>,
/// animation_clips: Res<AnimationClips>,
/// animation_nodes: Res<AnimationNodes>,
/// ) {
/// for (mut animating_state, controller, mut animation_player) in query.iter_mut() {
/// match animating_state.update_by_discriminant({
Expand All @@ -50,7 +50,9 @@ use bevy::prelude::*;
/// }) {
/// TnuaAnimatingStateDirective::Maintain { state } => {
/// if let AnimationState::Running(speed) = state {
/// animation_player.set_speed(*speed);
/// if let Some(active_animation) = animation_player.animation_mut(animation_nodes.running) {
/// active_animation.set_speed(*speed);
/// }
/// }
/// }
/// TnuaAnimatingStateDirective::Alter {
Expand All @@ -61,13 +63,13 @@ use bevy::prelude::*;
/// } => match state {
/// AnimationState::Standing => {
/// animation_player
/// .start(animation_clips.standing.clone_weak())
/// .start(animation_nodes.standing)
/// .set_speed(1.0)
/// .repeat();
/// }
/// AnimationState::Running(speed) => {
/// animation_player
/// .start(animation_clips.standing.clone_weak())
/// .start(animation_nodes.running)
/// .set_speed(*speed)
/// .repeat();
/// }
Expand Down

0 comments on commit 7731be8

Please sign in to comment.