preparation of building asset structure

This commit is contained in:
2024-11-14 22:52:54 -05:00
parent fe98627186
commit ea271c25d0
13 changed files with 102 additions and 11 deletions

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,