place core to start the game
This commit is contained in:
parent
3a25a1bd87
commit
1ecd054a31
8 changed files with 67 additions and 24 deletions
|
|
@ -5,6 +5,7 @@
|
|||
use bevy::prelude::*;
|
||||
use building::{BuildingInfo, BuildingPreview, Core, PREVIEW_ALPHA, PopulatePlacedBuilding};
|
||||
use combat::{Defense, Health, Range};
|
||||
use state::CoreState;
|
||||
use ui_range_indicator::CustomRangeIndicator;
|
||||
|
||||
pub struct BuildingCorePlugin;
|
||||
|
|
@ -22,6 +23,9 @@ struct CoreResources {
|
|||
info_entity: Entity,
|
||||
}
|
||||
|
||||
#[derive(Component)]
|
||||
pub struct CorePreview;
|
||||
|
||||
const SIZE: UVec3 = UVec3::new(2, 2, 2);
|
||||
|
||||
fn register(
|
||||
|
|
@ -50,6 +54,7 @@ fn register(
|
|||
Visibility::Hidden,
|
||||
Mesh3d(mesh.clone()),
|
||||
MeshMaterial3d(preview_material),
|
||||
CorePreview,
|
||||
))
|
||||
.id();
|
||||
commands.entity(info).insert((
|
||||
|
|
@ -74,6 +79,7 @@ fn populate(
|
|||
trigger: Trigger<PopulatePlacedBuilding>,
|
||||
mut commands: Commands,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
mut next_core_state: ResMut<NextState<CoreState>>,
|
||||
res: Res<CoreResources>,
|
||||
) {
|
||||
if trigger.event().info != res.info_entity {
|
||||
|
|
@ -91,4 +97,5 @@ fn populate(
|
|||
..default()
|
||||
})),
|
||||
));
|
||||
next_core_state.set(CoreState::Placed);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue