WIP loading meshes for prefabs
This commit is contained in:
@@ -1,7 +1,4 @@
|
||||
use bevy::{
|
||||
ecs::{component::Component, system::EntityCommands, world::World},
|
||||
math::Vec3,
|
||||
};
|
||||
use bevy::prelude::*;
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
use crate::prefab::{ComponentBuilder, PrefabAsset};
|
||||
@@ -12,7 +9,7 @@ struct Name {
|
||||
}
|
||||
#[typetag::serde]
|
||||
impl ComponentBuilder for Name {
|
||||
fn insert(&self, _entity: &mut EntityCommands) {
|
||||
fn build(&self, _entity: &mut EntityCommands, _: &AssetServer) {
|
||||
assert_eq!(self.name, "Test".to_string(), "Name");
|
||||
}
|
||||
}
|
||||
@@ -24,7 +21,7 @@ struct Position {
|
||||
|
||||
#[typetag::serde]
|
||||
impl ComponentBuilder for Position {
|
||||
fn insert(&self, _entity: &mut EntityCommands) {
|
||||
fn build(&self, _entity: &mut EntityCommands, _: &AssetServer) {
|
||||
assert_eq!(self.pos, Vec3::X, "Position");
|
||||
}
|
||||
}
|
||||
@@ -38,6 +35,7 @@ fn round_trip_test() {
|
||||
name: "Test".to_string(),
|
||||
}),
|
||||
],
|
||||
..default()
|
||||
};
|
||||
|
||||
let serialized = ron::to_string(&prefab);
|
||||
@@ -52,13 +50,4 @@ fn round_trip_test() {
|
||||
prefab.components.len(),
|
||||
"Prefab's components count do not match"
|
||||
);
|
||||
|
||||
let mut world = World::new();
|
||||
let e = world.spawn_empty().id();
|
||||
let mut commands = world.commands();
|
||||
let mut ec = commands.entity(e);
|
||||
|
||||
for component in loaded_asset.components {
|
||||
component.insert(&mut ec);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user