Package framework.timing.SystemClockComponent

Examples of framework.timing.SystemClockComponent.TimePassedEvent


  public void onEvent(Event e) {
    if(e != null){
      if(e.getType().equals("TimePassed")){
        OrientationComponent orientaion = (OrientationComponent) getSiblingByType(OrientationComponent.class.getName());
        if(orientaion != null){
          TimePassedEvent t = (TimePassedEvent) e;
          orientaion.setValue(orientaion.getValue()+t.getDelta()*this.getValue());
        }
      }
    }
  }
 
View Full Code Here


      }else if(e.getType().equals("TimePassed")){
        PositionComponent posComp = (PositionComponent) getSiblingByType(PositionComponent.class.getName());
        if(posComp != null){
          Vector2f pos = posComp.getVector();
          if(pos != null && centreOfOrbit != null && !pos.equals(centreOfOrbit)){
            TimePassedEvent t = (TimePassedEvent) e;
            posComp.setVector(VectorUtil.rotateAround(pos.copy(), centreOfOrbit, t.getDelta()*orbitalVelocity));
          }
        }
      }
    }
  } 
 
View Full Code Here

  @Override
  public void onEvent(Event e) {
    if(e != null && e.getType() == "TimePassed"){
      PositionComponent pos = (PositionComponent) getSiblingByType(PositionComponent.class.getName());
      if(pos != null){
        TimePassedEvent time = (TimePassedEvent) e;
        pos.addVector(this.getVector().scale(time.getDelta()));
      }
    }
  }
View Full Code Here

      VelocityComponent vel = (VelocityComponent) getSiblingByType(VelocityComponent.class.getName());
      if(vel == null && getParent() != null){
        vel = new VelocityComponent(0,0);
        getParent().addComponent(vel);
      }
      TimePassedEvent time = (TimePassedEvent) e;
      vel.addVector(this.getVector().scale(time.getDelta()));
    }
  }
View Full Code Here

TOP

Related Classes of framework.timing.SystemClockComponent.TimePassedEvent

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.