Package fr.utbm.gi.vi51.pw.environment

Examples of fr.utbm.gi.vi51.pw.environment.WorldModelState


    List<Perception> perceptions = getPerceivedObjects();

    if (this.seekBehaviour!=null && !perceptions.isEmpty()) {

      Perception percept = perceptions.get(0);

      if (percept.getPerceivedObject() instanceof MouseTarget) {
        Point2d target = new Point2d(percept.getPerceivedObject().getPosition());

        // run the seek behaviour
        output = this.seekBehaviour.runSeek(position, linearSpeed, getMaxLinear(), target);
      }
      else {
View Full Code Here


      double x1 = agent.getX();
      double y1 = agent.getY();
     
      // add mouse target in perceptions
      if (this.mouseTarget!=null) {
        allPercepts.add(new Perception(this.mouseTarget));
      }

      double bestDistance = Double.MAX_VALUE;
      AgentBody nearestBody = null;
     
      for(AgentBody b1 : getAgentBodies()) {
        if (b1!=agent) {
          double x2 = b1.getX();
          double y2 = b1.getY();
          double distance = new Vector2d(x2-x1,y2-y1).length();
          if (distance<bestDistance) {
            bestDistance = distance;
            nearestBody = b1;
          }
        }
      }
     
      if (nearestBody!=null) {
        allPercepts.add(new Perception(nearestBody));
      }
    }
   
    return allPercepts;
  }
View Full Code Here

    List<Perception> perceptions = getPerceivedObjects();

    if (this.seekBehaviour!=null && !perceptions.isEmpty())
    {
      Perception percept = perceptions.get(0);
    }

    //Take a decision
    currentAction.setAction(Action.BuildABridge);
   
View Full Code Here

          }
        }
      }
     
      if (nearestBody!=null) {
        allPercepts.add(new Perception(nearestBody));
      }
    }
   
    return allPercepts;
  }
View Full Code Here

 
  public AnimatAction Gravity(LemmingBody body, AnimatAction animatAction)
  {
    for(int index2=0; index2<mapElements.size(); index2++)
    {
      SituatedObject element = mapElements.get(index2);
      if (element != null)
      {
        if (collision(body.getX(), body.getWidth() + body.getX(), element.getX(), element.getWidth() + element.getX())
            && collision(body.getY(), body.getHeight() + body.getY(), element.getY(), element.getHeight() + element.getY()))
        {
          body.setFallingTime(0);
          return new AnimatAction(body, new Vector2d(animatAction.getTranslation().x, (double) 0), animatAction.getRotation());
        }
      }
View Full Code Here

        LocalizedString.get(MainProgram.class, "USE_STEERING_MESSAGE"), //$NON-NLS-1$
        LocalizedString.get(MainProgram.class, "USE_STEERING_TITLE"), //$NON-NLS-1$
        JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION;

    FrameworkGUI gui = new GUI(WORLD_SIZE_X, WORLD_SIZE_Y);
   
    Environment environment = new WorldModel(WORLD_SIZE_X, WORLD_SIZE_Y);
   
    FrameworkLauncher.launchEnvironment(environment, gui, EXECUTION_DELAY);
View Full Code Here

        LocalizedString.get(MainProgram.class, "USE_STEERING_MESSAGE"), //$NON-NLS-1$
        LocalizedString.get(MainProgram.class, "USE_STEERING_TITLE"), //$NON-NLS-1$
        JOptionPane.YES_NO_OPTION,
        JOptionPane.QUESTION_MESSAGE) == JOptionPane.YES_OPTION;

    FrameworkGUI gui = new GUI(WORLD_SIZE_X, WORLD_SIZE_Y);
   
    Environment environment = new WorldModel(WORLD_SIZE_X, WORLD_SIZE_Y);
   
    FrameworkLauncher.launchEnvironment(environment, gui, EXECUTION_DELAY);
View Full Code Here

    assert(environment!=null);
    if (environmentSingleton==null) {
      environmentSingleton = environment;
      uiSingleton = gui;
      if (gui!=null) environment.addEnvironmentListener(gui);
      Kernel k = Kernels.create(new SimulationScheduler(environment, waitDuration));
      k.addKernelListener(new KernelAdapter(){
        /**
         * {@inheritDoc}
         */
        @SuppressWarnings("synthetic-access")
 
View Full Code Here

  /**
   * @param width is the width of the world.
   * @param height is the height of the world.
   */
  public WorldModel(double width, double height) {
    super(width, height, new SimulationTimeManager(500));
  }
View Full Code Here

  /**
   * @param width is the width of the world.
   * @param height is the height of the world.
   */
  public WorldModel(double width, double height) {
    super(width, height, new SimulationTimeManager(500));
   
   
    getMap();
    actionApplier = new ActionApplier(this);
    physicsEngine = new PhysicsEngine(mapElements);
View Full Code Here

TOP

Related Classes of fr.utbm.gi.vi51.pw.environment.WorldModelState

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.