Package org.timerescue.action

Examples of org.timerescue.action.Action$Constants


   * get a state of a given class
   * @return null we don't have an state of that class
   */
  public Action getState(Class<?> clas){
    for (Iterator<Action> iterator = active_states.iterator(); iterator.hasNext();) {
      Action action = iterator.next();
      if (action.getClass().equals(clas)) {
        return action;
      }
    }
    return null;
  }
View Full Code Here


      sendParametersToAgent(
          getSorroundings(
            agent.getCoordinate(),
            Coordinate.Constants.DEFAULT_NEIGHBOR_RADIO), agent);
      //Ask the agent what to do
      Action action = agent.decide();
      //Executes the action
      executeAction(action);
     
    }
View Full Code Here

   * Send all enviroment's conditions to agents
   */
  private void applyConditions() {
    //Conditions Loop
    for (Iterator<Action> iterator = conditions.iterator(); iterator.hasNext();) {
      Action condition = iterator.next();
      //Agents Loop
      for (Iterator<Agent> agent_iterator = agents.iterator();
          agent_iterator.hasNext();) {
        Agent agent = agent_iterator.next();
        sendParametersToAgent(condition, agent);
View Full Code Here

   * @param race
   */
  protected void loadRace(Race race) {
    Action[] skills = race.getPassive_skills();
    for (int i = 0; i < skills.length; i++) {
      Action skill = skills[i];
      executeAction(skill);
    }
  }
View Full Code Here

 
  /*
   * Wander method Wraps AI definition methods
   */
  public Action decide() {
    Action wander_action = null;
   
    //Check if any prolonged states remains
   
   
    //Tell if agent is been controlled by a player
View Full Code Here

  /* (non-Javadoc)
   * @see org.timerescue.droid.element.agent.DecisionMaker#wanderNonePlayer()
   */
  @Override
  public Action decideNonePlayer() {       
    Action decision = null;
    String aggressiveness = property_holder.getCurrentProperty(
        Constants.Property.AGGRESSIVENESS);
    //TODO pass this to behaviors
    //Getting environment information
    //I am already attacking? or am i the target?
    if (state_holder.isStateActive(DefaultAttackAction.class)){     
      DefaultAttackAction attack = (DefaultAttackAction) state_holder.getState(
          DefaultAttackAction.class);
      Agent target = attack.getTarget();
      //Counter attack if it is the target
      decision = attack(target);
      //If the target couldn't be reached remove states
      if(decision.equals(null)){
        attack.removeStates();
      }
    }else{
      //Is it aggressive?
      if (Boolean.parseBoolean(aggressiveness)){     
View Full Code Here

TOP

Related Classes of org.timerescue.action.Action$Constants

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.