Skip to content

Commit

Permalink
Add camera tweening to dialog
Browse files Browse the repository at this point in the history
  • Loading branch information
janhohenheim committed Sep 16, 2024
1 parent 6bcbb17 commit 1d30196
Show file tree
Hide file tree
Showing 9 changed files with 248 additions and 167 deletions.
17 changes: 17 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ bevy_yarnspinner = "0.3"
bevy_yarnspinner_example_dialogue_view = "0.3"
avian_interpolation3d = { git = "https://github.com/janhohenheim/avian_interpolation" }
bevy-inspector-egui = { version = "0.25.2", optional = true }
bevy_tweening = "0.11.0"

# Generic dependencies
rand = "0.8"
Expand Down
122 changes: 69 additions & 53 deletions assets/registry.json
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,27 @@
"type": "array",
"typeInfo": "Tuple"
},
"(foxtrot::player::camera::PlayerCamera, foxtrot::player::camera::PlayerCameraConfig)": {
"isComponent": false,
"isResource": false,
"items": false,
"long_name": "(foxtrot::player::camera::PlayerCamera, foxtrot::player::camera::PlayerCameraConfig)",
"prefixItems": [
{
"type": {
"$ref": "#/$defs/foxtrot::player::camera::PlayerCamera"
}
},
{
"type": {
"$ref": "#/$defs/foxtrot::player::camera::PlayerCameraConfig"
}
}
],
"short_name": "(PlayerCamera, PlayerCameraConfig)",
"type": "array",
"typeInfo": "Tuple"
},
"(foxtrot::player::interactions::components::PlayerInteractionParameters, foxtrot::player::interactions::components::AvailablePlayerInteraction, foxtrot::player::interactions::components::PlayerInteraction)": {
"isComponent": false,
"isResource": false,
Expand Down Expand Up @@ -15227,15 +15248,15 @@
}
}
},
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::axislike::Axislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::axislike::Axislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"isComponent": false,
"isResource": false,
"keyType": {
"type": {
"$ref": "#/$defs/foxtrot::player::camera::first_person::CameraAction"
"$ref": "#/$defs/foxtrot::player::camera::CameraAction"
}
},
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::axislike::Axislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::axislike::Axislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"short_name": "HashMap<CameraAction, Vec<Box<dyn Axislike>>, DefaultHashBuilder>",
"type": "object",
"typeInfo": "Map",
Expand All @@ -15245,15 +15266,15 @@
}
}
},
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::buttonlike::Buttonlike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::buttonlike::Buttonlike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"isComponent": false,
"isResource": false,
"keyType": {
"type": {
"$ref": "#/$defs/foxtrot::player::camera::first_person::CameraAction"
"$ref": "#/$defs/foxtrot::player::camera::CameraAction"
}
},
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::buttonlike::Buttonlike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::buttonlike::Buttonlike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"short_name": "HashMap<CameraAction, Vec<Box<dyn Buttonlike>>, DefaultHashBuilder>",
"type": "object",
"typeInfo": "Map",
Expand All @@ -15263,15 +15284,15 @@
}
}
},
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::dualaxislike::DualAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::dualaxislike::DualAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"isComponent": false,
"isResource": false,
"keyType": {
"type": {
"$ref": "#/$defs/foxtrot::player::camera::first_person::CameraAction"
"$ref": "#/$defs/foxtrot::player::camera::CameraAction"
}
},
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::dualaxislike::DualAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::dualaxislike::DualAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"short_name": "HashMap<CameraAction, Vec<Box<dyn DualAxislike>>, DefaultHashBuilder>",
"type": "object",
"typeInfo": "Map",
Expand All @@ -15281,15 +15302,15 @@
}
}
},
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::tripleaxislike::TripleAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::tripleaxislike::TripleAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"isComponent": false,
"isResource": false,
"keyType": {
"type": {
"$ref": "#/$defs/foxtrot::player::camera::first_person::CameraAction"
"$ref": "#/$defs/foxtrot::player::camera::CameraAction"
}
},
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::tripleaxislike::TripleAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::tripleaxislike::TripleAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"short_name": "HashMap<CameraAction, Vec<Box<dyn TripleAxislike>>, DefaultHashBuilder>",
"type": "object",
"typeInfo": "Map",
Expand All @@ -15299,15 +15320,15 @@
}
}
},
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, leafwing_input_manager::action_state::action_data::ActionData, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, leafwing_input_manager::action_state::action_data::ActionData, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>": {
"isComponent": false,
"isResource": false,
"keyType": {
"type": {
"$ref": "#/$defs/foxtrot::player::camera::first_person::CameraAction"
"$ref": "#/$defs/foxtrot::player::camera::CameraAction"
}
},
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, leafwing_input_manager::action_state::action_data::ActionData, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"long_name": "bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, leafwing_input_manager::action_state::action_data::ActionData, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>",
"short_name": "HashMap<CameraAction, ActionData, DefaultHashBuilder>",
"type": "object",
"typeInfo": "Map",
Expand Down Expand Up @@ -18341,52 +18362,28 @@
"type": "object",
"typeInfo": "Struct"
},
"foxtrot::player::camera::PlayerCamera": {
"additionalProperties": false,
"isComponent": true,
"isResource": false,
"long_name": "foxtrot::player::camera::PlayerCamera",
"properties": {
"sensitivity": {
"type": {
"$ref": "#/$defs/glam::Vec2"
}
}
},
"required": [
"sensitivity"
],
"short_name": "PlayerCamera",
"type": "object",
"typeInfo": "Struct"
},
"foxtrot::player::camera::first_person::CameraAction": {
"foxtrot::player::camera::CameraAction": {
"isComponent": false,
"isResource": false,
"long_name": "foxtrot::player::camera::first_person::CameraAction",
"long_name": "foxtrot::player::camera::CameraAction",
"oneOf": [
"RotateCamera"
],
"short_name": "CameraAction",
"type": "string",
"typeInfo": "Enum"
},
"foxtrot::player::camera::first_person::FirstPersonCamera": {
"foxtrot::player::camera::PlayerCamera": {
"additionalProperties": false,
"isComponent": true,
"isResource": false,
"long_name": "foxtrot::player::camera::first_person::FirstPersonCamera",
"long_name": "foxtrot::player::camera::PlayerCamera",
"properties": {
"follow": {
"type": {
"$ref": "#/$defs/bevy_transform::components::transform::Transform"
}
},
"look_at": {
"type": {
"$ref": "#/$defs/core::option::Option<glam::Vec3>"
}
},
"offset": {
"type": {
"$ref": "#/$defs/bevy_transform::components::transform::Transform"
Expand All @@ -18397,7 +18394,26 @@
"follow",
"offset"
],
"short_name": "FirstPersonCamera",
"short_name": "PlayerCamera",
"type": "object",
"typeInfo": "Struct"
},
"foxtrot::player::camera::PlayerCameraConfig": {
"additionalProperties": false,
"isComponent": true,
"isResource": false,
"long_name": "foxtrot::player::camera::PlayerCameraConfig",
"properties": {
"sensitivity": {
"type": {
"$ref": "#/$defs/glam::Vec2"
}
}
},
"required": [
"sensitivity"
],
"short_name": "PlayerCameraConfig",
"type": "object",
"typeInfo": "Struct"
},
Expand Down Expand Up @@ -19525,15 +19541,15 @@
"type": "object",
"typeInfo": "Struct"
},
"leafwing_input_manager::action_state::ActionState<foxtrot::player::camera::first_person::CameraAction>": {
"leafwing_input_manager::action_state::ActionState<foxtrot::player::camera::CameraAction>": {
"additionalProperties": false,
"isComponent": true,
"isResource": true,
"long_name": "leafwing_input_manager::action_state::ActionState<foxtrot::player::camera::first_person::CameraAction>",
"long_name": "leafwing_input_manager::action_state::ActionState<foxtrot::player::camera::CameraAction>",
"properties": {
"action_data": {
"type": {
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, leafwing_input_manager::action_state::action_data::ActionData, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, leafwing_input_manager::action_state::action_data::ActionData, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
}
},
"disabled": {
Expand Down Expand Up @@ -19901,11 +19917,11 @@
"type": "object",
"typeInfo": "Struct"
},
"leafwing_input_manager::input_map::InputMap<foxtrot::player::camera::first_person::CameraAction>": {
"leafwing_input_manager::input_map::InputMap<foxtrot::player::camera::CameraAction>": {
"additionalProperties": false,
"isComponent": true,
"isResource": true,
"long_name": "leafwing_input_manager::input_map::InputMap<foxtrot::player::camera::first_person::CameraAction>",
"long_name": "leafwing_input_manager::input_map::InputMap<foxtrot::player::camera::CameraAction>",
"properties": {
"associated_gamepad": {
"type": {
Expand All @@ -19914,22 +19930,22 @@
},
"axislike_map": {
"type": {
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::axislike::Axislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::axislike::Axislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
}
},
"buttonlike_map": {
"type": {
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::buttonlike::Buttonlike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::buttonlike::Buttonlike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
}
},
"dual_axislike_map": {
"type": {
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::dualaxislike::DualAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::dualaxislike::DualAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
}
},
"triple_axislike_map": {
"type": {
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::first_person::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::tripleaxislike::TripleAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
"$ref": "#/$defs/bevy_utils::hashbrown::HashMap<foxtrot::player::camera::CameraAction, alloc::vec::Vec<std::boxed::Box<dyn leafwing_input_manager::user_input::trait_reflection::tripleaxislike::TripleAxislike>>, bevy_utils::hashbrown::hash_map::DefaultHashBuilder>"
}
}
},
Expand Down
4 changes: 2 additions & 2 deletions src/level.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ use bevy::{color::palettes::tailwind, prelude::*};
use blenvy::*;

use crate::{
player::camera::switch_to_first_person_camera,
player::camera::spawn_player_camera,
screens::{gameplay::GameplayState, Screen},
};

Expand Down Expand Up @@ -34,7 +34,7 @@ pub fn spawn_level(world: &mut World) {
color: tailwind::SKY_100.into(),
brightness: 400.0,
});
switch_to_first_person_camera(world);
spawn_player_camera(world);
}

fn finish_spawning_level(
Expand Down
2 changes: 2 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use bevy::{
log::LogPlugin,
prelude::*,
};
use bevy_tweening::TweeningPlugin;
use blenvy::BlenvyPlugin;
use sickle_ui::SickleUiPlugin;

Expand Down Expand Up @@ -88,6 +89,7 @@ impl Plugin for AppPlugin {
PhysicsPlugins::default().build().disable::<SyncPlugin>(),
AvianInterpolationPlugin::default(),
SickleUiPlugin,
TweeningPlugin,
));

// Add internal plugins.
Expand Down
Loading

0 comments on commit 1d30196

Please sign in to comment.