Examples of WorldObject


Examples of ca.nengo.ui.lib.world.WorldObject

    }

    @Override
    protected void action() throws ActionException {
        WorldObject selectedNode = SelectionHandler.getActiveObject();

        UINetwork selectedNetwork = UINetwork.getClosestNetwork(selectedNode);
        if (selectedNetwork != null) {

            RunSimulatorAction runAction = new RunSimulatorAction("run", selectedNetwork);
View Full Code Here

Examples of ca.nengo.ui.lib.world.WorldObject

        super(description);
    }

    @Override
    protected void action() throws ActionException {
        WorldObject selectedNode = SelectionHandler.getActiveObject();

        UINetwork selectedNetwork = UINetwork.getClosestNetwork(selectedNode);
        if (selectedNetwork != null) {

            SaveNodeAction saveNodeAction = new SaveNodeAction(selectedNetwork);
View Full Code Here

Examples of ca.nengo.ui.lib.world.WorldObject

        super(description);
    }

    @Override
    protected void action() throws ActionException {
        WorldObject selectedNode = SelectionHandler.getActiveObject();

        UINetwork selectedNetwork = UINetwork.getClosestNetwork(selectedNode);
        if (selectedNetwork != null) {

            GeneratePythonScriptAction generatePythonScriptAction = new GeneratePythonScriptAction(selectedNetwork);
View Full Code Here

Examples of net.sf.fysix.world.WorldObject

        Body body2 = cp.shape2.getBody();
        float mass1 = body1.getMass();
        float mass2 = body2.getMass();

       
        WorldObject wo1 = null;
        WorldObject wo2 = null;
       
      ObjectHistory oh = objectHist.get(currentHistory);
      for (WorldObjectState wos : oh.stateobjs){
        if(wos.getBody().equals(body1) || wos.getBody().equals(body2)){
          System.out.println("Velocity : " + wos.getVelocity().length());
          System.out.println("Mass : " + wos.getMass());
          System.out.println("Type : " + wos.getType());
          if(wo1 == null){
            wo1 = wos.getWOPtr();
          } else if(wo2 == null){
            wo2= wos.getWOPtr();
            break;
          }
        }
      }
       
      // Give damage to each other depending on the opposite velocity and mass
      // TODO: USCH!
      if(wo1 != null && wo2 != null){
        if(wo1.getType().compareTo(TypeE.GAME_MAP) != 0){
          wo1.doDamage(1000);
        }
        if(wo1.isDestroyed()){
          removeBodyLst.add(body1);
        }
     
        if(wo2.getType().compareTo(TypeE.GAME_MAP) != 0){
          wo2.doDamage(1000);
        }
        if(wo2.isDestroyed()){
          removeBodyLst.add(body2);
        }
      }
    }
    contacts.clear(); // TODO: DON'T USE CONTACTS, MAKE A COPY!
View Full Code Here

Examples of net.sf.fysix.world.WorldObject

      //
      // PLAYER 1
      //
      int shots = input1.checkEvent(InputAction.SHOOT);
      if (shots > 0) {
        WorldObject bullet = new Planet(2,50, TypeE.WEAPON_SHOT_MINE);
        Vector2d dir = new Vector2d(Math.cos(player1.getWorldObject().getRotation()), Math.sin(player1.getWorldObject().getRotation()));
        Vector2d pos = player1.getWorldObject().getPosition();
        pos.addScaled(16, dir);
        bullet.setPosition(pos);
        dir.scale(1000000);
        //bullet.setVelocity(dir);
        world.addObject(bullet, true);
        bullet.applyImpulse(dir);
        //dir.scale(-1);
        //playerShip.applyImpulse(dir);
      }
     
      //
      // PLAYER 2
      //
      shots = input2.checkEvent(InputAction.SHOOT);
      if (shots > 0) {
        WorldObject bullet = new Planet(2,50, TypeE.WEAPON_SHOT_MINE);
        Vector2d dir = new Vector2d(Math.cos(player2.getWorldObject().getRotation()), Math.sin(player2.getWorldObject().getRotation()));
        Vector2d pos = player2.getWorldObject().getPosition();
        pos.addScaled(16, dir);
        bullet.setPosition(pos);
        dir.scale(1000000);
        //bullet.setVelocity(dir);
        world.addObject(bullet, true);
        bullet.applyImpulse(dir);
      }
     
      // Advance the game time by one tick
      engine.tick(1.0 / tickRate);
      nextTick += NANOS_PER_SEC / tickRate;
View Full Code Here

Examples of org.osm2world.core.world.data.WorldObject

   *
   * @param node  one of the nodes of {@link #segment}
   */
  private GroundState getGroundState(MapNode node) {
   
    WorldObject primaryWO = node.getPrimaryRepresentation();
   
    if (primaryWO != null) {
     
      return primaryWO.getGroundState();
     
    } else if (this.getGroundState() == ON) {
     
      return ON;
     
View Full Code Here

Examples of org.osm2world.core.world.data.WorldObject

        if (connectedSegment != this.segment) {
          previousSegment = connectedSegment;
        }
      }
     
      WorldObject previousWO = previousSegment.getPrimaryRepresentation();
     
      if (previousWO instanceof AbstractNetworkWaySegmentWorldObject) {
       
        AbstractNetworkWaySegmentWorldObject previous =
            (AbstractNetworkWaySegmentWorldObject)previousWO;
View Full Code Here

Examples of org.osm2world.core.world.data.WorldObject

     * at intersections */
   
    for (MapOverlap<?,?> overlap : segment.getOverlaps()) {
     
      MapElement other = overlap.getOther(segment);
      WorldObject otherWO = other.getPrimaryRepresentation();
     
      if (otherWO == null
          || otherWO.getGroundState() != ON//TODO remove the ground state check
        continue;
     
      boolean thisIsUpper = this.getGroundState() == ABOVE; //TODO check layers
     
      double distance = 10.0; //TODO base on clearing
     
      if (overlap instanceof MapIntersectionWW) {
       
        MapIntersectionWW intersection = (MapIntersectionWW) overlap;
       
        if (otherWO instanceof AbstractNetworkWaySegmentWorldObject) {
         
          AbstractNetworkWaySegmentWorldObject otherANWSWO =
              ((AbstractNetworkWaySegmentWorldObject)otherWO);
         
          EleConnector thisConn = primaryRep.getEleConnectors()
              .getConnector(intersection.pos);
          EleConnector otherConn = otherANWSWO.getEleConnectors()
              .getConnector(intersection.pos);
         
          if (thisIsUpper) {
            enforcer.requireVerticalDistance(
                MIN, distance, thisConn, otherConn);
          } else {
            enforcer.requireVerticalDistance(
                MIN, distance, otherConn, thisConn);
          }
         
        }
       
      } else if (overlap instanceof MapOverlapWA) {
       
        /*
         * require minimum distance at intersection points
         * (these have been inserted into this segment,
         * but not into the area)
         */
       
        MapOverlapWA overlapWA = (MapOverlapWA) overlap;
       
        if (overlap.type == MapOverlapType.INTERSECT
            && otherWO instanceof AbstractAreaWorldObject) {
         
          AbstractAreaWorldObject otherAAWO =
              ((AbstractAreaWorldObject)otherWO);
         
          for (int i = 0; i < overlapWA.getIntersectionPositions().size(); i++) {
           
            VectorXZ pos =
                overlapWA.getIntersectionPositions().get(i);
            MapAreaSegment areaSegment =
                overlapWA.getIntersectingAreaSegments().get(i);
           
            EleConnector thisConn = primaryRep.getEleConnectors()
                .getConnector(pos);
           
            EleConnector base1 = otherAAWO.getEleConnectors()
                .getConnector(areaSegment.getStartNode().getPos());
            EleConnector base2 = otherAAWO.getEleConnectors()
                .getConnector(areaSegment.getEndNode().getPos());
                       
            if (thisConn != null && base1 != null && base2 != null) {
             
              if (thisIsUpper) {
                enforcer.requireVerticalDistance(MIN, distance,
                    thisConn, base1, base2);
              } else {
                enforcer.requireVerticalDistance(MAX, -distance,
                    thisConn, base1, base2);
              }
             
            }
           
          }
         
        }
       
        /*
         * require minimum distance to the area's elevation connectors.
         * There is usually no direct counterpart for these in this segment.
         * Examples include trees on terrain above tunnels.
         */
       
        if (!(otherWO instanceof Forest)) continue; //TODO enable and debug for other WO classes
       
        eleConnectors:
        for (EleConnector c : otherWO.getEleConnectors()) {
         
          if (outlinePolygonXZ == null ||
              !outlinePolygonXZ.contains(c.pos))
            continue eleConnectors;
         
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.