Mirgrate to bevy 0.14.0

This commit is contained in:
2024-07-09 01:14:45 -04:00
parent ba2dcf7129
commit 0294ce6d24
20 changed files with 1189 additions and 981 deletions

View File

@@ -1,9 +1,5 @@
use asset_loader::create_asset_loader;
use bevy::{
asset::{Asset, Handle},
reflect::TypePath,
render::render_resource::encase::rts_array::Length,
};
use bevy::{asset::Asset, reflect::TypePath, render::render_resource::encase::rts_array::Length};
use serde::{Deserialize, Serialize};
use crate::{biome_asset::BiomeAsset, map::biome_map::BiomeData};
@@ -16,16 +12,16 @@ pub struct BiomePainterAsset {
}
impl BiomePainterAsset {
pub fn sample_biome(&self, assets: &Assets<BiomeAsset>, data: &BiomeData) -> Handle<BiomeAsset> {
pub fn sample_biome(&self, assets: &Assets<BiomeAsset>, data: &BiomeData) -> AssetId<BiomeAsset> {
assert!(self.biomes.length() != 0, "There are no biomes");
let mut biome = self.biomes.first().unwrap().clone();
let mut biome = self.biomes.first().unwrap().id();
let mut dist = f32::INFINITY;
for b in &self.biomes {
let asset = assets.get(b).unwrap();
let asset = assets.get(b.id()).unwrap();
let d = asset.distance(data.into());
if d < dist {
biome = b.clone();
biome = b.id();
dist = d;
}
}
@@ -36,7 +32,7 @@ impl BiomePainterAsset {
pub fn build(&self, assets: &Assets<BiomeAsset>) -> BiomePainter {
let mut biomes = Vec::with_capacity(self.biomes.len());
for b in &self.biomes {
let asset = assets.get(b.clone()).unwrap();
let asset = assets.get(b.id()).unwrap();
biomes.push(asset.clone());
}
return BiomePainter { biomes };