Package framework.component.list

Examples of framework.component.list.SingleTypeComponentList


  }

  private List<RenderableComponent> getAllRenderableComponents(){
    List<RenderableComponent> renderableComponents = new ArrayList<RenderableComponent>();

    SingleTypeComponentList spriteComps = ComponentSystem.getInstance().getAllComponents().getComponentsOfType(SpriteComponent.class.getName());
    if(spriteComps != null){
      renderableComponents.addAll((Collection)spriteComps.getAllComponents());
    }

    SingleTypeComponentList textComps = ComponentSystem.getInstance().getAllComponents().getComponentsOfType(TextRenderComponent.class.getName());
    if(textComps != null){
      renderableComponents.addAll((Collection)textComps.getAllComponents());
    }

    if(showCollisionBoxes){
      SingleTypeComponentList collisComps = ComponentSystem.getInstance().getAllComponents().getComponentsOfType(CollisionComponent.class.getName());
      if(collisComps != null){
        renderableComponents.addAll((Collection)collisComps.getAllComponents());
      }
    }

    return (List<RenderableComponent>) renderableComponents;
  }
View Full Code Here


    if(pos != null && pos.getVector() != null && this.mask != null){

      checkOldCollisionsAreStillHappening(pos.getVector());

      MultiTypeComponentList allComps = ComponentSystem.getInstance().getAllComponents();
      SingleTypeComponentList allCollisComps = allComps.getComponentsOfType(CollisionComponent.class.getName());
      if(allCollisComps != null){
        SpacialFilter filter = new SpacialFilter(pos.getVector(), getMask());
        Collection<Component> allColliding = allCollisComps.getComponents(filter);
        if(allColliding != null){
          for(Component comp:allColliding){
            if(!comp.equals(this)){
              CollisionComponent c = (CollisionComponent) comp;
              if(!isInContactWith(c, false)){
View Full Code Here

      if(c.equals(mask)) return false;
      PositionComponent p = (PositionComponent)  (c instanceof PositionComponent ? c : c.getSiblingByType(PositionComponent.class.getName()));
      if(p != null){
        Vector2f otherOrigin = p.getVector();
        if(otherOrigin != null){
          SingleTypeComponentList comps = p.getSiblingsByType(CollisionComponent.class.getName());
          if(comps != null){
            for(Component collis: comps){
              if(this.mask.isCollision(this.origin, otherOrigin, ((CollisionComponent) collis).getMask())){
                return true;
              }
View Full Code Here

      c.writeToStream(out);
    }
  }

  public Component getChildByType(String type){
    SingleTypeComponentList children = getChildrenByType(type);
    if(children != null){
      return children.getComponent(0);
    }else{
      return null;
    }
  }
View Full Code Here

  public MultiTypeComponentList getAllComponents(){
    return componentGrid;
  }

  public Collection<Component> getComponentsOfType(String type){
    SingleTypeComponentList comps = componentGrid.getComponentsOfType(type);
    return comps != null ? comps.getAllComponents() : null;
  }
View Full Code Here

TOP

Related Classes of framework.component.list.SingleTypeComponentList

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.