Android Open Source - rpg Nav Path






From Project

Back to project page rpg.

License

The source code is released under:

Apache License

If you think the Android project rpg listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package org.aschyiel.rpg.graph;
//  ww w  .  j a  v a2s.  c  o  m
import java.util.List;

import org.aschyiel.rpg.IGameObject; 
import org.aschyiel.rpg.graph.Navigator.NavCallback;

/**
* A simple way of keeping track of both the game-object,
* and the current step in the navigation steps.
*/
public class NavPath
{
  protected final IGameObject unit;

  protected final List<Step> steps;

  /**
   * The current step index.
   */
  private int idx = 0;

  protected NavCallback cb;

  public NavPath( final IGameObject unit, final List<Step> steps )
  {
    this.unit  = unit;
    this.steps = steps;
  }
  
  protected void incrementStep()
  {
    idx++;
  }

  /**
  * Returns true if we're done with all of our steps.
  */
  protected boolean isAtDestination()
  {
    return idx > steps.size() - 1;
  }

  protected Step getCurrentStep()
  {
    return ( idx < steps.size() )?
        steps.get( idx ) : null;
  }

  /**
  * A mechanic for re-routing;
  * Essentially tacks-on new steps to our existing steps.
  */
  protected void swapIn( final List<Step> detour )
  {
    idx = 0;
    steps.clear();
    steps.addAll( detour );
  }
}




Java Source Code List

org.aschyiel.rpg.Coords.java
org.aschyiel.rpg.Focus.java
org.aschyiel.rpg.GameObjectFactory.java
org.aschyiel.rpg.GameObject.java
org.aschyiel.rpg.ICanHasFocus.java
org.aschyiel.rpg.IFullGameObject.java
org.aschyiel.rpg.IGameObject.java
org.aschyiel.rpg.PowerChords.java
org.aschyiel.rpg.Resorcerer.java
org.aschyiel.rpg.activities.Launcher.java
org.aschyiel.rpg.activities.Sandbox.java
org.aschyiel.rpg.activities.Terrain.java
org.aschyiel.rpg.activities.sandbox.BasicCombat.java
org.aschyiel.rpg.activities.sandbox.BasicMovement.java
org.aschyiel.rpg.activities.sandbox.MovementVsLandTypes.java
org.aschyiel.rpg.graph.ChessBoard.java
org.aschyiel.rpg.graph.DefaultPathFinder.java
org.aschyiel.rpg.graph.GirlFriend.java
org.aschyiel.rpg.graph.NavPath.java
org.aschyiel.rpg.graph.Navigator.java
org.aschyiel.rpg.graph.OnSquareClickHandler.java
org.aschyiel.rpg.graph.PathFinder.java
org.aschyiel.rpg.graph.Step.java
org.aschyiel.rpg.graph.VacancySubscriber.java
org.aschyiel.rpg.level.LandType.java
org.aschyiel.rpg.level.LevelDetail.java
org.aschyiel.rpg.level.Level.java
org.aschyiel.rpg.level.Player.java
org.aschyiel.rpg.level.UnitType.java