basic core building

This commit is contained in:
Jim 2025-08-24 20:13:22 -04:00
parent f5d022d1d0
commit af45237701
Signed by: jim
GPG key ID: 3236D2F059A7C0AC
11 changed files with 146 additions and 11 deletions

View file

@ -10,6 +10,7 @@ avian3d = { workspace = true }
state = { path = "../state" }
camera = { path = "../camera" }
combat = { path = "../combat" }
building_core = { path = "../building_core" }
[lints]
workspace = true

View file

@ -9,6 +9,7 @@ use bevy::{
prelude::*,
render::camera::Exposure,
};
use building_core::SpawnCore;
use camera::ControlledCamera;
use combat::{Attacked, Defense, Health};
use state::AppState;
@ -25,13 +26,15 @@ fn setup(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
mut core_writer: EventWriter<SpawnCore>,
) {
let level_size = 50.0;
// Static physics object with a collision shape
commands.spawn((
RigidBody::Static,
Collider::cuboid(level_size, 0.5, level_size),
Mesh3d(meshes.add(Cuboid::new(level_size, 0.5, level_size))),
Collider::cuboid(level_size, 1.0, level_size),
Mesh3d(meshes.add(Cuboid::new(level_size, 1.0, level_size))),
Transform::from_xyz(0.0, -0.5, 0.0),
MeshMaterial3d(materials.add(StandardMaterial {
base_color: Color::srgb_u8(52, 125, 117),
perceptual_roughness: 0.8,
@ -72,6 +75,10 @@ fn setup(
);
}
core_writer.write(SpawnCore {
transform: Transform::from_xyz(5.0, 1.0, 5.0),
});
// Light
commands.spawn((
DirectionalLight {