6 Commits

Author SHA1 Message Date
ea271c25d0 preparation of building asset structure 2024-11-14 22:52:54 -05:00
fe98627186 misc 2024-11-11 20:46:21 -05:00
576ea96e9b Merge branch 'master' into lunex 2024-11-11 18:45:43 -05:00
ba7b3abc25 cleanup 2024-11-10 21:35:51 -05:00
4271167752 packed testing 2024-11-09 22:21:24 -05:00
c5a3d1c401 lunex testing 2024-11-06 22:42:25 -05:00
26 changed files with 401 additions and 91 deletions

185
Cargo.lock generated
View File

@@ -745,6 +745,30 @@ dependencies = [
"encase_derive_impl",
]
[[package]]
name = "bevy_eventlistener"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "63aff74ac1477b88b57ff2f82fc711a7931414be7ee7d0e96aeea45b6d4a7cb6"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_eventlistener_derive",
"bevy_hierarchy",
"bevy_utils",
]
[[package]]
name = "bevy_eventlistener_derive"
version = "0.8.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fc779559aa23b81da2b14fba90586755d225983c5b6d3154658e42fc088de7f"
dependencies = [
"proc-macro2 1.0.86",
"quote 1.0.36",
"syn 2.0.70",
]
[[package]]
name = "bevy_gilrs"
version = "0.14.2"
@@ -913,6 +937,18 @@ dependencies = [
"tracing-wasm",
]
[[package]]
name = "bevy_lunex"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "32e2bb6bf7507c23bb69edf4f045312448b8dbba73b85dda58e9178255ece099"
dependencies = [
"bevy",
"bevy_mod_picking",
"colored",
"lunex_engine",
]
[[package]]
name = "bevy_macro_utils"
version = "0.14.2"
@@ -948,6 +984,48 @@ dependencies = [
"glam",
]
[[package]]
name = "bevy_mod_picking"
version = "0.20.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e290b8ad3e72dc621da7a9c21129da10540d78290ef8857353190e0213cac692"
dependencies = [
"bevy_app",
"bevy_core",
"bevy_ecs",
"bevy_eventlistener",
"bevy_math",
"bevy_picking_core",
"bevy_picking_highlight",
"bevy_picking_input",
"bevy_picking_raycast",
"bevy_picking_selection",
"bevy_reflect",
"bevy_render",
"bevy_utils",
"bevy_window",
]
[[package]]
name = "bevy_mod_raycast"
version = "0.18.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d9e4ff45885c4716771a9f55977d8ce69596502a5241da55bf608d7cd71a9cb3"
dependencies = [
"bevy_app",
"bevy_asset",
"bevy_color",
"bevy_derive",
"bevy_ecs",
"bevy_math",
"bevy_reflect",
"bevy_render",
"bevy_transform",
"bevy_utils",
"bevy_window",
"crossbeam-channel",
]
[[package]]
name = "bevy_pbr"
version = "0.14.2"
@@ -975,6 +1053,90 @@ dependencies = [
"static_assertions",
]
[[package]]
name = "bevy_picking_core"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "020b6cf6079927a1e6a3dd883986546632d8d09ab77840997f4936a74eade722"
dependencies = [
"bevy_app",
"bevy_derive",
"bevy_ecs",
"bevy_eventlistener",
"bevy_math",
"bevy_reflect",
"bevy_render",
"bevy_transform",
"bevy_utils",
"bevy_window",
"uuid",
]
[[package]]
name = "bevy_picking_highlight"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8ba45161608da1bb58cbc55fd83cf5e529e616a180778c394733c85056cd2b76"
dependencies = [
"bevy_app",
"bevy_asset",
"bevy_color",
"bevy_ecs",
"bevy_picking_core",
"bevy_picking_selection",
"bevy_reflect",
]
[[package]]
name = "bevy_picking_input"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ba8cf67c68a5e150c066366744f9a44006ead9ad280de1c9ca69a6a13c5e283"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_hierarchy",
"bevy_input",
"bevy_math",
"bevy_picking_core",
"bevy_picking_selection",
"bevy_reflect",
"bevy_render",
"bevy_utils",
"bevy_window",
]
[[package]]
name = "bevy_picking_raycast"
version = "0.20.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0b024e7b0a6062aafd5daa746e5298a1b726c6409de11e35e0b574b712ebda3d"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_mod_raycast",
"bevy_picking_core",
"bevy_reflect",
"bevy_render",
"bevy_transform",
"bevy_window",
]
[[package]]
name = "bevy_picking_selection"
version = "0.20.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bf0769d84e944fbc09b0475f068e5232a8a4be15339796539aecd747413ededd"
dependencies = [
"bevy_app",
"bevy_ecs",
"bevy_eventlistener",
"bevy_input",
"bevy_picking_core",
"bevy_reflect",
"bevy_utils",
]
[[package]]
name = "bevy_ptr"
version = "0.14.2"
@@ -1608,6 +1770,16 @@ version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b"
[[package]]
name = "colored"
version = "2.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "cbf2150cce219b664a8a70df7a1f933836724b503f8a413af9365b4dcc4d90b8"
dependencies = [
"lazy_static",
"windows-sys 0.48.0",
]
[[package]]
name = "com"
version = "0.6.0"
@@ -3079,6 +3251,18 @@ dependencies = [
"imgref",
]
[[package]]
name = "lunex_engine"
version = "0.2.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "64d55d2e631c0eb2d5bc164ca826452f550a57a9b0d8da93e6e5625d23f533bd"
dependencies = [
"bevy",
"colored",
"indexmap",
"thiserror",
]
[[package]]
name = "mach2"
version = "0.4.2"
@@ -3966,6 +4150,7 @@ dependencies = [
"bevy",
"bevy-inspector-egui",
"bevy_asset_loader",
"bevy_lunex",
"bevy_rapier3d",
"buildings",
"image 0.25.2",

View File

@@ -41,9 +41,9 @@ pub const HEX_NORMALS: [Vec3; 6] = [
];
pub const ATTRIBUTE_PACKED_VERTEX_DATA: MeshVertexAttribute =
MeshVertexAttribute::new("PackedVertexData", 988540817, VertexFormat::Uint32);
MeshVertexAttribute::new("PackedVertexData", 7, VertexFormat::Uint32);
pub const ATTRIBUTE_VERTEX_HEIGHT: MeshVertexAttribute =
MeshVertexAttribute::new("VertexHeight", 988540717, VertexFormat::Float32);
MeshVertexAttribute::new("VertexHeight", 8, VertexFormat::Float32);
pub const ATTRIBUTE_TEXTURE_INDEX: MeshVertexAttribute =
MeshVertexAttribute::new("TextureIndex", 988540917, VertexFormat::Uint32);

View File

@@ -1,9 +1,5 @@
use crate::hex_utils::HexCoord;
use crate::map::biome_map::BiomeChunk;
use crate::hex_utils::{offset3d_to_world, HexCoord};
use crate::prelude::*;
use crate::tile_manager::TileAsset;
use crate::tile_mapper::TileMapperAsset;
use crate::{biome_asset::BiomeAsset, biome_painter::BiomePainterAsset};
use bevy::{
prelude::*,
render::{
@@ -12,15 +8,7 @@ use bevy::{
},
};
pub fn generate_packed_chunk_mesh(
chunk: &Chunk,
map: &Map,
biome_chunk: &BiomeChunk,
painter: &BiomePainterAsset,
tiles: &Res<Assets<TileAsset>>,
biomes: &Res<Assets<BiomeAsset>>,
mappers: &Res<Assets<TileMapperAsset>>,
) -> Mesh {
pub fn generate_packed_chunk_mesh(chunk: &MeshChunkData) -> Mesh {
let vertex_count: usize = Chunk::SIZE * Chunk::SIZE * 6;
let mut packed_data = Vec::with_capacity(vertex_count);
let mut indices = Vec::with_capacity(vertex_count);
@@ -28,16 +16,10 @@ pub fn generate_packed_chunk_mesh(
for z in 0..Chunk::SIZE {
for x in 0..Chunk::SIZE {
let height = chunk.heights[x + z * Chunk::SIZE];
let data = biome_chunk.data[x + z * Chunk::SIZE];
let coord =
HexCoord::from_offset(IVec2::new(x as i32, z as i32) + (chunk.chunk_offset * Chunk::SIZE as i32));
let n = map.get_neighbors(&coord);
let biome = biomes.get(painter.sample_biome(biomes, &data)).unwrap();
let mapper = mappers.get(biome.tile_mapper.id());
let tile_handle = mapper.unwrap().sample_tile(height);
let tile = tiles.get(tile_handle).unwrap();
let idx = x + z * Chunk::SIZE;
let height = chunk.heights[idx];
let coord = HexCoord::from_grid_pos(x, z);
let n = chunk.get_neighbors(&coord);
create_packed_tile(
UVec2::new(x as u32, z as u32),
@@ -46,8 +28,8 @@ pub fn generate_packed_chunk_mesh(
&mut packed_data,
&mut indices,
&mut heights,
tile.texture_id,
tile.side_texture_id,
chunk.textures[idx][0],
chunk.textures[idx][1],
);
}
}
@@ -65,7 +47,7 @@ pub fn generate_packed_chunk_mesh(
fn create_packed_tile(
offset: UVec2,
height: f32,
neighbors: &[Option<f32>; 6],
neighbors: &[f32; 6],
packed_data: &mut Vec<u32>,
indices: &mut Vec<u32>,
heights: &mut Vec<f32>,
@@ -85,23 +67,18 @@ fn create_packed_tile(
}
for i in 0..neighbors.len() {
let cur_n = neighbors[i];
match cur_n {
Some(n_height) => {
if n_height < height {
create_packed_tile_wall(
offset,
height,
n_height,
i,
packed_data,
indices,
heights,
side_texture_index,
);
}
}
_ => {}
let n_height = neighbors[i];
if n_height < height {
create_packed_tile_wall(
offset,
height,
n_height,
i,
packed_data,
indices,
heights,
side_texture_index,
);
}
}
}

View File

@@ -3,7 +3,13 @@ use bevy::prelude::*;
use serde::{Deserialize, Serialize};
use shared::identifiers::ResourceIdentifier;
use crate::footprint::BuildingFootprint;
use crate::{
buildings::{
basic_building::BasicBuildingInfo, factory_building::FactoryBuildingInfo,
resource_gathering::ResourceGatheringBuildingInfo,
},
footprint::BuildingFootprint,
};
#[derive(Asset, TypePath, Debug, Serialize, Deserialize)]
pub struct BuildingAsset {
@@ -17,8 +23,25 @@ pub struct BuildingAsset {
pub cost: Vec<ResourceIdentifier>,
pub consumption: Vec<ResourceIdentifier>,
pub production: Vec<ResourceIdentifier>,
pub health: u32,
pub building_type: BuildingType,
pub animations: Vec<AnimationComponent>,
}
#[derive(Serialize, Deserialize, Debug, TypePath)]
pub enum BuildingType {
Basic,
Gathering(ResourceGatheringBuildingInfo),
FactoryBuildingInfo(FactoryBuildingInfo),
}
#[derive(Serialize, Deserialize, Debug, Reflect)]
pub enum AnimationComponent {
Rotation,
Slider,
}
create_asset_loader!(
BuildingAssetPlugin,
BuildingAssetLoader,

View File

@@ -0,0 +1,4 @@
use serde::{Deserialize, Serialize};
use shared::identifiers::ResourceIdentifier;
#[derive(Serialize, Deserialize, Debug)]
pub struct BasicBuildingInfo {}

View File

@@ -0,0 +1,6 @@
use serde::{Deserialize, Serialize};
#[derive(Serialize, Deserialize, Debug)]
pub struct FactoryBuildingInfo {
pub units_to_build: Vec<()>
}

View File

@@ -0,0 +1,4 @@
pub mod resource_gathering;
pub mod basic_building;
pub mod factory_building;
pub mod tech_building;

View File

@@ -0,0 +1,8 @@
use serde::{Deserialize, Serialize};
use shared::identifiers::ResourceIdentifier;
#[derive(Serialize, Deserialize, Debug)]
pub struct ResourceGatheringBuildingInfo {
pub resources_to_gather: Vec<ResourceIdentifier>,
pub gather_range: usize,
}

View File

@@ -0,0 +1,9 @@
use serde::{Deserialize, Serialize};
use shared::{building::BuildingIdentifier, StatusEffect};
#[derive(Serialize, Deserialize, Debug)]
pub struct TechBuildingInfo {
pub effect_range: usize,
pub buildings_to_unlock: Vec<BuildingIdentifier>,
pub buffs: Vec<StatusEffect>,
}

View File

@@ -4,4 +4,5 @@ pub mod building_plugin;
pub mod buildings_map;
pub mod footprint;
pub mod prelude;
mod buildings;
pub use building_plugin::*;

View File

@@ -27,6 +27,7 @@ bevy_asset_loader = { version = "0.21.0", features = [
] }
ron = "0.8.1"
image = "0.25.2"
bevy_lunex = "0.2.4"
[features]
tracing = [

View File

@@ -2,7 +2,9 @@ use bevy::core_pipeline::experimental::taa::{TemporalAntiAliasBundle, TemporalAn
use bevy::core_pipeline::prepass::DepthPrepass;
use bevy::input::mouse::{MouseMotion, MouseScrollUnit, MouseWheel};
use bevy::prelude::*;
use bevy::render::view::RenderLayers;
use bevy::window::{CursorGrabMode, PrimaryWindow};
use bevy_lunex::prelude::MainUi;
use shared::sets::GameplaySet;
use shared::tags::MainCamera;
use world_generation::hex_utils::HexCoord;
@@ -59,8 +61,10 @@ fn setup(mut commands: Commands, mut msaa: ResMut<Msaa>) {
MainCamera,
DepthPrepass,
PhosOrbitCamera::default(),
MainUi,
))
.insert(TemporalAntiAliasBundle::default());
.insert(TemporalAntiAliasBundle::default())
.insert(RenderLayers::layer(0));
*msaa = Msaa::Off;
}

View File

@@ -1,3 +1,5 @@
use std::env;
use bevy::pbr::wireframe::WireframePlugin;
use bevy::prelude::*;
use bevy::render::texture::{ImageAddressMode, ImageFilterMode, ImageSamplerDescriptor};
@@ -10,8 +12,8 @@ mod map_rendering;
mod phos;
mod prelude;
mod shader_extensions;
mod utlis;
mod ui;
mod utlis;
fn main() {
App::new()

View File

@@ -3,6 +3,7 @@ use bevy::log::*;
use bevy::{
pbr::{ExtendedMaterial, NotShadowCaster},
prelude::*,
render::render_resource::{ColorTargetState, FragmentState, RenderPipelineDescriptor},
};
use bevy_asset_loader::prelude::*;
@@ -219,6 +220,7 @@ fn spawn_map(
) {
paint_map(&mut heightmap, &biome_painter, &tile_assets, &tile_mappers);
//Prepare Mesh Data
let map_size = UVec2::new(heightmap.width as u32, heightmap.height as u32);
let chunk_meshes: Vec<_> = heightmap
.chunks
@@ -236,6 +238,8 @@ fn spawn_map(
.collect();
let mut registry = PhosChunkRegistry::new(chunk_meshes.len());
//Spawn Chunks
{
#[cfg(feature = "tracing")]
let _spawn_span = info_span!("Spawn Chunks").entered();
@@ -277,20 +281,6 @@ fn spawn_map(
}
}
// commands.spawn((
// MaterialMeshBundle {
// transform: Transform::from_translation(heightmap.get_center()),
// mesh: meshes.add(
// Plane3d::default()
// .mesh()
// .size(heightmap.get_world_width(), heightmap.get_world_height()),
// ),
// material: atlas.water_material.clone(),
// ..default()
// },
// NotShadowCaster,
// ));
commands.insert_resource(registry);
generator_state.set(GeneratorState::Idle);
if cur_game_state.get() != &MenuState::InGame {

View File

@@ -1,4 +1,5 @@
use bevy::prelude::*;
use shared::tags::MainCamera;
use crate::camera_system::components::PhosCamera;
@@ -52,7 +53,7 @@ impl Default for RenderDistanceVisibility {
fn render_distance_system(
mut objects: Query<(&Transform, &mut Visibility, &RenderDistanceVisibility)>,
camera_query: Query<&Transform, With<PhosCamera>>,
camera_query: Query<&Transform, With<MainCamera>>,
settings: Res<RenderDistanceSettings>,
) {
let camera = camera_query.single();

View File

@@ -1,6 +1,7 @@
use crate::camera_system::components::PhosCamera;
use crate::map_rendering::map_init::MapInitPlugin;
use crate::map_rendering::render_distance_system::RenderDistancePlugin;
use crate::ui::game::build_ui::BuildUiPlugin;
use crate::utlis::editor_plugin::EditorPlugin;
use crate::utlis::tile_selection_plugin::TileSelectionPlugin;
use crate::{camera_system::camera_plugin::PhosCameraPlugin, utlis::debug_plugin::DebugPlugin};
@@ -37,6 +38,7 @@ impl Plugin for PhosGamePlugin {
MapInitPlugin,
RenderDistancePlugin,
BuildingPugin,
BuildUiPlugin,
UnitsPlugin,
DespawnPuglin,
TileSelectionPlugin,

View File

@@ -1,8 +1,10 @@
use bevy::asset::{Asset, Handle};
use bevy::pbr::MaterialExtension;
use bevy::pbr::{Material, MaterialExtension};
use bevy::reflect::TypePath;
use bevy::render::mesh::{MeshVertexAttribute, MeshVertexBufferLayoutRef};
use bevy::render::render_resource::{AsBindGroup, ShaderRef};
use bevy::render::texture::Image;
use world_generation::consts::{ATTRIBUTE_PACKED_VERTEX_DATA, ATTRIBUTE_VERTEX_HEIGHT};
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
pub struct ChunkMaterial {
@@ -15,25 +17,50 @@ impl MaterialExtension for ChunkMaterial {
fn fragment_shader() -> ShaderRef {
"shaders/world/chunk.wgsl".into()
}
}
// fn vertex_shader() -> ShaderRef {
#[derive(Asset, TypePath, AsBindGroup, Debug, Clone)]
pub struct PackedChunkMaterial {
#[texture(100, dimension = "2d_array")]
#[sampler(101)]
pub array_texture: Handle<Image>,
}
impl Material for PackedChunkMaterial {
fn fragment_shader() -> ShaderRef {
"shaders/world/chunk.wgsl".into()
}
fn vertex_shader() -> ShaderRef {
"shaders/world/chunk_packed.wgsl".into()
}
fn prepass_vertex_shader() -> ShaderRef {
"shaders/world/chunk_packed.wgsl".into()
}
// fn deferred_vertex_shader() -> ShaderRef {
// "shaders/world/chunk_packed.wgsl".into()
// }
// fn specialize(
// _pipeline: &bevy::pbr::MaterialExtensionPipeline,
// descriptor: &mut bevy::render::render_resource::RenderPipelineDescriptor,
// layout: &bevy::render::mesh::MeshVertexBufferLayout,
// _key: bevy::pbr::MaterialExtensionKey<Self>,
// ) -> Result<(), bevy::render::render_resource::SpecializedMeshPipelineError> {
// let vertex_layout = layout.get_layout(&[
// // Mesh::ATTRIBUTE_POSITION.at_shader_location(0),
// // Mesh::ATTRIBUTE_UV_0.at_shader_location(1),
// // Mesh::ATTRIBUTE_NORMAL.at_shader_location(2),
// ATTRIBUTE_PACKED_VERTEX_DATA.at_shader_location(7),
// ATTRIBUTE_VERTEX_HEIGHT.at_shader_location(8),
// ])?;
// descriptor.vertex.buffers = vec![vertex_layout];
// Ok(())
// fn opaque_render_method(&self) -> bevy::pbr::OpaqueRendererMethod {
// return OpaqueRendererMethod::Auto;
// }
fn specialize(
_pipeline: &bevy::pbr::MaterialPipeline<Self>,
descriptor: &mut bevy::render::render_resource::RenderPipelineDescriptor,
layout: &MeshVertexBufferLayoutRef,
_key: bevy::pbr::MaterialPipelineKey<Self>,
) -> Result<(), bevy::render::render_resource::SpecializedMeshPipelineError> {
let vertex_layout = layout.0.get_layout(&[
// Mesh::ATTRIBUTE_POSITION.at_shader_location(0),
// Mesh::ATTRIBUTE_UV_0.at_shader_location(1),
// Mesh::ATTRIBUTE_NORMAL.at_shader_location(2),
ATTRIBUTE_PACKED_VERTEX_DATA.at_shader_location(7),
ATTRIBUTE_VERTEX_HEIGHT.at_shader_location(8),
])?;
descriptor.vertex.buffers = vec![vertex_layout];
Ok(())
}
}

View File

@@ -1,11 +1,54 @@
use bevy::prelude::*;
use bevy::{prelude::*, render::view::RenderLayers};
use bevy_lunex::prelude::*;
use shared::tags::MainCamera;
pub struct BuildUiPlugin;
impl Plugin for BuildUiPlugin {
fn build(&self, app: &mut App) {
app.add_systems(PostStartup, setup);
// app.add_plugins(UiDefaultPlugins)
// .add_plugins(UiDebugPlugin::<MainUi>::new());
app.add_systems(PostStartup, setup_ui);
}
}
fn setup(mut commands: Commands) {}
fn setup_ui(mut commands: Commands, assets: Res<AssetServer>) {
commands
.spawn((
Camera2dBundle {
transform: Transform::from_xyz(0.0, 0.0, 1000.0),
..default()
},
MainUi,
))
.insert(RenderLayers::layer(1));
commands
.spawn((
UiTreeBundle::<MainUi> {
tree: UiTree::new2d("BuildUi"),
..default()
},
Name::new("Build UI"),
SourceFromCamera,
RenderLayers::layer(1),
))
.with_children(|ui| {
ui.spawn((
UiLink::<MainUi>::path("Root"),
UiLayout::boundary()
.pos1(Ab(20.0))
.pos2(Rl(100.0) - Ab(20.0))
.pack::<Base>(),
RenderLayers::layer(1),
));
ui.spawn((
UiLink::<MainUi>::path("Root/Rect"),
UiLayout::solid().size((Ab(1920.0), Ab(1080.0))).pack::<Base>(),
UiImage2dBundle::from(assets.load("textures/world/test2.png")),
RenderLayers::layer(1),
));
});
}

View File

@@ -1,2 +1 @@
pub mod build_ui;

View File

@@ -1,2 +1 @@
pub mod game;

View File

@@ -13,6 +13,7 @@ use world_generation::{
generators::{
chunk_colliders::generate_chunk_collider,
mesh_generator::{generate_chunk_mesh, generate_chunk_water_mesh},
packed_mesh_generator::generate_packed_chunk_mesh,
},
hex_utils::offset_to_world,
prelude::{Chunk, Map, MeshChunkData},

View File

@@ -1,6 +1,7 @@
use bevy::reflect::Reflect;
use serde::{Deserialize, Serialize};
#[derive(Default, PartialEq, Eq, Serialize, Deserialize)]
#[derive(Default, Reflect, Debug, PartialEq, Eq, Serialize, Deserialize)]
pub struct BuildingIdentifier(pub usize);
impl From<i32> for BuildingIdentifier {

View File

@@ -1,9 +1,15 @@
use bevy::prelude::Resource;
use bevy::reflect::Reflect;
use serde::{Deserialize, Serialize};
use world_generation::hex_utils::HexCoord;
#[derive(Serialize, Deserialize, Debug)]
#[derive(Serialize, Deserialize, Debug, Reflect)]
pub struct ResourceIdentifier {
pub id: u32,
pub qty: u32,
}
#[derive(Serialize, Deserialize, Debug, Reflect)]
pub struct UnitIdentifier(u32);
#[derive(Serialize, Deserialize, Debug, Reflect)]
pub struct TileIdentifier(u32);

View File

@@ -1,3 +1,4 @@
use bevy::reflect::Reflect;
use serde::{Deserialize, Serialize};
pub mod building;
@@ -17,3 +18,17 @@ pub enum Tier {
Three,
Superior,
}
#[derive(Serialize, Deserialize, Debug, Reflect)]
pub enum StatusEffect {
UnitRange(f32),
UnitAttack(f32),
UnitHealth(f32),
StructureRange(f32),
StructureAttack(f32),
StructureHealth(f32),
BuildSpeedMulti(f32),
BuildCostMulti(f32),
ConsumptionMulti(f32),
ProductionMulti(f32),
}

View File

@@ -1,3 +1,5 @@
use bevy::reflect::Reflect;
use serde::{Deserialize, Serialize};
pub mod assets;
pub mod components;