WORKS!! FINALLY ANIMATION ON REPEAT
This commit is contained in:
parent
c135e7c557
commit
c186019b52
Binary file not shown.
@ -1,13 +0,0 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub struct AnimationInstruction {
|
||||
pub keyframes: Vec<AnimationKeyFrame>
|
||||
}
|
||||
|
||||
/// This represents a blender keyframe.
|
||||
/// In the system part every keyframe's transform will be lerped linearly with the time in between them.
|
||||
pub struct AnimationKeyFrame {
|
||||
pub transform: Option<Transform>,
|
||||
pub visibility: Option<Visibility>,
|
||||
pub time: f32,
|
||||
}
|
@ -5,7 +5,7 @@ use bevy::prelude::*;
|
||||
use crate::{
|
||||
comps::core::markers::{holdable::InPlayerHands, player::PlayerHand, firearm::MagazineData},
|
||||
constants::player_values::DEFAULT_PLAYER_FIREARM,
|
||||
utils,
|
||||
utils, setup::animations::FirearmAnimations,
|
||||
};
|
||||
|
||||
use super::player_firing::PlayerFiringInfo;
|
||||
@ -45,7 +45,7 @@ pub fn spawn_firearm_on_player_hands(
|
||||
TimerMode::Once,
|
||||
);
|
||||
// Load animations
|
||||
/*commands.insert_resource(FirearmAnimations { reload_magazine: asset_server.load(format!("{}#Animation0", DEFAULT_PLAYER_FIREARM.firearm_data().asset_path)),
|
||||
rock_charging_handle: asset_server.load(format!("{}#Animation1", DEFAULT_PLAYER_FIREARM.firearm_data().asset_path)) })*/
|
||||
commands.insert_resource(FirearmAnimations { reload_magazine: asset_server.load(format!("{}#Animation0", DEFAULT_PLAYER_FIREARM.firearm_data().asset_path)),
|
||||
rock_charging_handle: asset_server.load(format!("{}#Animation1", DEFAULT_PLAYER_FIREARM.firearm_data().asset_path)) })
|
||||
}
|
||||
}
|
||||
|
@ -1,3 +1,2 @@
|
||||
pub mod guns;
|
||||
pub mod player;
|
||||
pub mod animations;
|
||||
pub mod player;
|
@ -0,0 +1,12 @@
|
||||
use bevy::prelude::*;
|
||||
|
||||
use crate::setup::animations::FirearmAnimations;
|
||||
|
||||
pub fn setup_scene_once_loaded(
|
||||
animations: Res<FirearmAnimations>,
|
||||
mut players: Query<&mut AnimationPlayer, Added<AnimationPlayer>>,
|
||||
) {
|
||||
for mut player in &mut players {
|
||||
player.play(animations.reload_magazine.clone_weak()).repeat();
|
||||
}
|
||||
}
|
@ -10,7 +10,7 @@ use crate::{
|
||||
},
|
||||
hands::capture_hand_usage,
|
||||
player_vertical_sync::sync_player_y_state,
|
||||
spawn_player::spawn_player,
|
||||
spawn_player::spawn_player, camera_effects::setup_scene_once_loaded,
|
||||
},
|
||||
},
|
||||
};
|
||||
@ -43,6 +43,6 @@ pub fn load_scene(application: &mut App) {
|
||||
application.add_systems(Update, capture_hand_usage);
|
||||
|
||||
application.add_systems(Startup, setup_lighting);
|
||||
//application.add_systems(Update, setup_scene_once_loaded);
|
||||
application.add_systems(Update, setup_scene_once_loaded);
|
||||
//application.add_systems(Update, play_animation);
|
||||
}
|
||||
|
@ -1,7 +1,7 @@
|
||||
/*use bevy::prelude::*;
|
||||
use bevy::prelude::*;
|
||||
|
||||
#[derive(Resource)]
|
||||
pub struct FirearmAnimations {
|
||||
pub reload_magazine: Handle<AnimationClip>,
|
||||
pub rock_charging_handle: Handle<AnimationClip>,
|
||||
}*/
|
||||
}
|
Loading…
Reference in New Issue
Block a user