pub struct EntityEditor<'w> { /* private fields */ }Implementations§
Source§impl<'w> EntityEditor<'w>
impl<'w> EntityEditor<'w>
pub fn new(world: &'w mut World) -> Self
Sourcepub fn add_components_by_index(
&mut self,
e: Entity,
components: &[ComponentIndex],
) -> Result<(), QueryError>
pub fn add_components_by_index( &mut self, e: Entity, components: &[ComponentIndex], ) -> Result<(), QueryError>
根据组件id列表一次添加或删除多个相应组件(true 为增加, false 为删除)
Sourcepub fn remove_components_by_index(
&mut self,
e: Entity,
components: &[ComponentIndex],
) -> Result<(), QueryError>
pub fn remove_components_by_index( &mut self, e: Entity, components: &[ComponentIndex], ) -> Result<(), QueryError>
根据组件id列表一次删除多个相应组件
Sourcepub fn alter_components_by_index(
&mut self,
e: Entity,
components: &[(ComponentIndex, bool)],
) -> Result<(), QueryError>
pub fn alter_components_by_index( &mut self, e: Entity, components: &[(ComponentIndex, bool)], ) -> Result<(), QueryError>
根据组件id列表一次添加或删除多个相应组件(true 为增加, false 为删除)
Sourcepub fn insert_entity_by_index(
&mut self,
components: &[ComponentIndex],
) -> Result<Entity, QueryError>
pub fn insert_entity_by_index( &mut self, components: &[ComponentIndex], ) -> Result<Entity, QueryError>
根据组件id列表一次插入多个相应组件
pub fn alloc_entity(&self) -> Entity
Sourcepub fn get_component<T: 'static>(&self, e: Entity) -> Result<&T, QueryError>
pub fn get_component<T: 'static>(&self, e: Entity) -> Result<&T, QueryError>
获取组件只读引用
Sourcepub fn get_component_mut<T: 'static>(
&mut self,
e: Entity,
) -> Result<Mut<'_, T>, QueryError>
pub fn get_component_mut<T: 'static>( &mut self, e: Entity, ) -> Result<Mut<'_, T>, QueryError>
获取组件可写引用
pub fn get_component_unchecked<T: 'static>(&self, e: Entity) -> &T
pub fn get_component_unchecked_mut<T: 'static>( &mut self, e: Entity, ) -> Mut<'_, T>
Sourcepub fn get_component_by_index<T: 'static>(
&self,
e: Entity,
index: ComponentIndex,
) -> Result<&T, QueryError>
pub fn get_component_by_index<T: 'static>( &self, e: Entity, index: ComponentIndex, ) -> Result<&T, QueryError>
根据组件id获取组件只读引用(性能相较get_component更好)
Sourcepub fn get_component_mut_by_index<T: 'static>(
&mut self,
e: Entity,
index: ComponentIndex,
) -> Result<Mut<'_, T>, QueryError>
pub fn get_component_mut_by_index<T: 'static>( &mut self, e: Entity, index: ComponentIndex, ) -> Result<Mut<'_, T>, QueryError>
根据组件id获取组件可写引用(性能相较get_component_mut更好)
pub fn get_component_unchecked_by_index<T: 'static>( &self, e: Entity, index: ComponentIndex, ) -> &T
pub fn get_component_unchecked_mut_by_index<T: 'static>( &mut self, e: Entity, index: ComponentIndex, ) -> Mut<'_, T>
Sourcepub fn init_component<T: 'static>(&mut self) -> ComponentIndex
pub fn init_component<T: 'static>(&mut self) -> ComponentIndex
获取组件id
Sourcepub fn contains_entity(&self, e: Entity) -> bool
pub fn contains_entity(&self, e: Entity) -> bool
是否包含实体
Sourcepub fn add_components<B: Bundle + 'static>(
&mut self,
e: Entity,
components: B,
) -> Result<(), QueryError>
pub fn add_components<B: Bundle + 'static>( &mut self, e: Entity, components: B, ) -> Result<(), QueryError>
添加多个组件 todo 改成add_bundle
Sourcepub fn insert_entity<B: Bundle + 'static>(&mut self, components: B) -> Entity
pub fn insert_entity<B: Bundle + 'static>(&mut self, components: B) -> Entity
插入多个组件,返回对应的实体
Sourcepub fn make_insert<B: Bundle + 'static>(&mut self) -> InsertState<B>
pub fn make_insert<B: Bundle + 'static>(&mut self) -> InsertState<B>
创建一个插入器
Sourcepub fn make_query<Q: FetchComponents + 'static, F: FilterComponents + 'static = ()>(
&mut self,
) -> QueryState<Q, F>
pub fn make_query<Q: FetchComponents + 'static, F: FilterComponents + 'static = ()>( &mut self, ) -> QueryState<Q, F>
创建一个查询器
Sourcepub fn make_alter<Q: FetchComponents + 'static, F: FilterComponents + 'static, A: Bundle + 'static, D: Bundle + 'static>(
&mut self,
) -> QueryAlterState<Q, F, A, D>
pub fn make_alter<Q: FetchComponents + 'static, F: FilterComponents + 'static, A: Bundle + 'static, D: Bundle + 'static>( &mut self, ) -> QueryAlterState<Q, F, A, D>
创建一个改变器
Trait Implementations§
Source§impl SystemParam for EntityEditor<'_>
impl SystemParam for EntityEditor<'_>
type Item<'w> = EntityEditor<'w>
Source§fn init_state(world: &mut World, meta: &mut SystemMeta) -> Self::State
fn init_state(world: &mut World, meta: &mut SystemMeta) -> Self::State
The item type returned when constructing this system param.
The value of this associated type should be
Self, instantiated with new lifetimes. Read moreSource§fn get_param<'world>(state: &'world mut Self::State) -> Self::Item<'world>
fn get_param<'world>(state: &'world mut Self::State) -> Self::Item<'world>
Creates a parameter to be passed into a
SystemParamFunction. Read morefn get_self<'world>(state: &'world mut Self::State) -> Self
fn init(_state: &mut Self::State)
Auto Trait Implementations§
impl<'w> Freeze for EntityEditor<'w>
impl<'w> !RefUnwindSafe for EntityEditor<'w>
impl<'w> Send for EntityEditor<'w>
impl<'w> Sync for EntityEditor<'w>
impl<'w> Unpin for EntityEditor<'w>
impl<'w> !UnwindSafe for EntityEditor<'w>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.