diff --git a/assets/weapons/m4a1_rifle.glb b/assets/weapons/m4a1_rifle.glb index 539abd9..366b2ad 100644 Binary files a/assets/weapons/m4a1_rifle.glb and b/assets/weapons/m4a1_rifle.glb differ diff --git a/src/logic/core/animations/mod.rs b/src/logic/core/animations/mod.rs deleted file mode 100644 index 6e806eb..0000000 --- a/src/logic/core/animations/mod.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bevy::prelude::*; - -pub struct AnimationInstruction { - pub keyframes: Vec -} - -/// 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, - pub visibility: Option, - pub time: f32, -} \ No newline at end of file diff --git a/src/logic/core/guns/spawn_firearm.rs b/src/logic/core/guns/spawn_firearm.rs index 9be1f48..4307994 100644 --- a/src/logic/core/guns/spawn_firearm.rs +++ b/src/logic/core/guns/spawn_firearm.rs @@ -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)) }) } } diff --git a/src/logic/core/mod.rs b/src/logic/core/mod.rs index a33b729..bedc585 100644 --- a/src/logic/core/mod.rs +++ b/src/logic/core/mod.rs @@ -1,3 +1,2 @@ pub mod guns; -pub mod player; -pub mod animations; \ No newline at end of file +pub mod player; \ No newline at end of file diff --git a/src/logic/core/player/camera_effects.rs b/src/logic/core/player/camera_effects.rs index e69de29..3e77089 100644 --- a/src/logic/core/player/camera_effects.rs +++ b/src/logic/core/player/camera_effects.rs @@ -0,0 +1,12 @@ +use bevy::prelude::*; + +use crate::setup::animations::FirearmAnimations; + +pub fn setup_scene_once_loaded( + animations: Res, + mut players: Query<&mut AnimationPlayer, Added>, +) { + for mut player in &mut players { + player.play(animations.reload_magazine.clone_weak()).repeat(); + } +} \ No newline at end of file diff --git a/src/scenes/scene1/init.rs b/src/scenes/scene1/init.rs index a9764e0..b118bc2 100644 --- a/src/scenes/scene1/init.rs +++ b/src/scenes/scene1/init.rs @@ -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); } diff --git a/src/setup/animations.rs b/src/setup/animations.rs index 2cd2990..dfea75d 100644 --- a/src/setup/animations.rs +++ b/src/setup/animations.rs @@ -1,7 +1,7 @@ -/*use bevy::prelude::*; +use bevy::prelude::*; #[derive(Resource)] pub struct FirearmAnimations { pub reload_magazine: Handle, pub rock_charging_handle: Handle, -}*/ \ No newline at end of file +} \ No newline at end of file