backpack implementation (#15)
This commit is contained in:
25
src/main.rs
25
src/main.rs
@@ -1,5 +1,6 @@
|
||||
mod aim;
|
||||
mod alien;
|
||||
mod backpack;
|
||||
mod billboards;
|
||||
mod camera;
|
||||
mod cash;
|
||||
@@ -94,6 +95,7 @@ fn main() {
|
||||
app.add_plugins(controls::plugin);
|
||||
app.add_plugins(sounds::plugin);
|
||||
app.add_plugins(camera::plugin);
|
||||
app.add_plugins(backpack::plugin);
|
||||
|
||||
app.insert_resource(AmbientLight {
|
||||
color: Color::WHITE,
|
||||
@@ -104,10 +106,7 @@ fn main() {
|
||||
|
||||
app.add_systems(Startup, (write_trenchbroom_config, music));
|
||||
app.add_systems(PostStartup, setup_scene);
|
||||
app.add_systems(
|
||||
Update,
|
||||
(set_materials_unlit, set_tonemapping, set_shadows, spawn_box),
|
||||
);
|
||||
app.add_systems(Update, (set_materials_unlit, set_tonemapping, set_shadows));
|
||||
|
||||
app.run();
|
||||
}
|
||||
@@ -137,24 +136,6 @@ fn setup_scene(mut commands: Commands, asset_server: Res<AssetServer>) {
|
||||
));
|
||||
}
|
||||
|
||||
fn spawn_box(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
keys: Res<ButtonInput<KeyCode>>,
|
||||
) {
|
||||
if keys.just_pressed(KeyCode::Enter) {
|
||||
commands.spawn((
|
||||
RigidBody::Dynamic,
|
||||
Collider::cuboid(5.0, 5.0, 5.0),
|
||||
AngularVelocity(Vec3::new(2.5, 3.5, 1.5)),
|
||||
Mesh3d(meshes.add(Cuboid::from_length(5.0))),
|
||||
MeshMaterial3d(materials.add(Color::srgb_u8(124, 144, 255))),
|
||||
Transform::from_xyz(0.0, 50.0, 0.0),
|
||||
));
|
||||
}
|
||||
}
|
||||
|
||||
fn music(asset_server: Res<AssetServer>, mut commands: Commands) {
|
||||
commands.spawn((
|
||||
AudioPlayer::new(asset_server.load("sfx/music/02.ogg")),
|
||||
|
||||
Reference in New Issue
Block a user