resource production via graveyard, workers, and selectable buildlings

This commit is contained in:
Jim 2025-08-31 22:26:07 -04:00
parent 87fcc35a49
commit 921947c131
Signed by: jim
GPG key ID: 3D7D94BA53088BF4
20 changed files with 364 additions and 24 deletions

View file

@ -16,6 +16,7 @@ use building::{BuildingTypes, PlaceBuilding};
use camera::ControlledCamera;
use inhabitant_coranth::SpawnCoranth;
use physics::{Ground, PhysicsLayers};
use resource_graveyard::PlaceGraveyard;
use state::{AppState, GameSystemSet};
pub struct LevelPlugin;
@ -34,6 +35,7 @@ fn setup(
buildings: Res<BuildingTypes>,
mut place_writer: EventWriter<PlaceBuilding>,
mut coranth_writer: EventWriter<SpawnCoranth>,
mut graveyard_writer: EventWriter<PlaceGraveyard>,
) {
let level_size = 50.0;
// Static physics object with a collision shape
@ -50,6 +52,7 @@ fn setup(
CollisionLayers::new(PhysicsLayers::Ground, LayerMask::ALL),
PhysicsPickable,
Ground,
Name::new("ground"),
));
for y in 5..15 {
@ -57,6 +60,9 @@ fn setup(
transform: Transform::from_xyz(y as f32 * 0.25, y as f32 * 1.1, 0.0),
});
}
graveyard_writer.write(PlaceGraveyard(Vec3::new(-10., 0.25, -10.)));
place_writer.write(PlaceBuilding {
info: buildings.info.get("Core").unwrap().0,
location: IVec3 { x: 5, y: 0, z: 5 },
@ -72,6 +78,11 @@ fn setup(
},
Transform::from_xyz(-2.5, 4.5, 2.5).looking_at(Vec3::ZERO, Dir3::Y),
));
commands.insert_resource(AmbientLight {
brightness: lux::AMBIENT_DAYLIGHT,
color: Color::srgb(0.98, 0.95, 0.82),
..default()
});
// Camera
commands.spawn((