pub fn has_component<T: Any>(&self, entity: &Entity) -> bool {
        if self.is_valid_entity(entity) {
            if self.components[entity.idx].contains::<T>() {
                return true;
            } else {
                // This entity doesn't have the component.
                // See if has inherited it from a parent.
                let mut cur_ent = *entity;
                println!("Start {}, {}", cur_ent.idx, cur_ent.uuid);
                loop  {
                    if self.is_valid_entity(&cur_ent) {
                        if self.components[cur_ent.idx].contains::<T>() {
                            return true;
                        }
                        if let Some(parent) = self.get_parent(&cur_ent) {
                            cur_ent = parent;
                            println!("Parent {}, {}", cur_ent.idx, cur_ent.uuid);
                        } else {
                            // No parents left.
                            break;
                        }
                    } else {
                        // No valid parents left.
                        break;
                    }
                }
            }
        }
        false
    }
/// Returns whether an entity has a specific component or not.
/// Does also search the parents for the component.
Returns whether an entity has a specific component or not.
Does also search the parents for the component.
Returns whether an entity has a specific component or not . Does also search the parents for the component .
pub fn has_component<T: Any>(&self, entity: &Entity) -> bool {
        if self.is_valid_entity(entity) {
            if self.components[entity.idx].contains::<T>() {
                return true;
            } else {
                // This entity doesn't have the component.
                // See if has inherited it from a parent.
                let mut cur_ent = *entity;
                println!("Start {}, {}", cur_ent.idx, cur_ent.uuid);
                loop  {
                    if self.is_valid_entity(&cur_ent) {
                        if self.components[cur_ent.idx].contains::<T>() {
                            return true;
                        }
                        if let Some(parent) = self.get_parent(&cur_ent) {
                            cur_ent = parent;
                            println!("Parent {}, {}", cur_ent.idx, cur_ent.uuid);
                        } else {
                            // No parents left.
                            break;
                        }
                    } else {
                        // No valid parents left.
                        break;
                    }
                }
            }
        }
        false
    }
pub fn has_component < T : Any > ( & self , entity : & Entity ) -> bool { if self . is_valid_entity ( entity ) { if self . components [ entity . idx ] . contains :: < T > ( ) { return true ; } else { // This entity doesn't have the component. // See if has inherited it from a parent. let mut cur_ent = * entity ; println ! ( " " cur_ent idx cur_ent uuid ) ; loop { if self . is_valid_entity ( & cur_ent ) { if self . components [ cur_ent . idx ] . contains :: < T > ( ) { return true ; } if let Some ( parent ) = self . get_parent ( & cur_ent ) { cur_ent = parent ; println ! ( " " cur_ent idx cur_ent uuid ) ; } else { // No parents left. break ; } } else { // No valid parents left. break ; } } } } false }
Returns whether an entity has a specific component or not.
Returns whether an entity has a specific component or not .
&self
entity
&Entity
&self
entity
&Entity