Class Path

  • Direct Known Subclasses:
    LocalPath, TilePath

    public abstract class Path
    extends java.lang.Object
    • Constructor Summary

      Constructors 
      Constructor Description
      Path​(double precision)  
    • Constructor Detail

      • Path

        public Path​(double precision)
    • Method Detail

      • traverse

        public abstract boolean traverse​(APIContext ctx)
        Takes a step along this path if appropriate.
        Parameters:
        ctx - APIContext
        Returns:
        true if we are traversing this path, otherwise false. False can mean the destination is already reached or path destination is unreachable.
      • traverse

        public abstract boolean traverse​(APIContext ctx,
                                         boolean enableRun)
        Takes a step along this path if appropriate.
        Parameters:
        ctx - APIContext
        enableRun - true to enable run
        Returns:
        true if we are traversing this path, otherwise false. False can mean the destination is already reached or path destination is unreachable.
      • validate

        public abstract boolean validate​(APIContext ctx)
        Checks whether or not this path can be traversed by the player. This will be the case when the player is near to one of its vertices, but not already standing on the end vertex.
        Parameters:
        ctx - APIContext
        Returns:
        true if the player can walk along this path, false otherwise
      • getNext

        public abstract Tile getNext​(APIContext ctx)
        Gets the next available tile in this path.
        Parameters:
        ctx - APIContext
        Returns:
        the next tile or null
      • getStart

        public abstract Tile getStart()
        Gets the start tile of this path.
        Returns:
        the start tile
      • getEnd

        public abstract Tile getEnd()
        Gets the end tile of this path.
        Returns:
        the end tile
      • getTiles

        public abstract Tile[] getTiles()
      • getPrecision

        public double getPrecision()
        Gets the allowed precision of this path. For example: with a precision of 2 the path will not be traversed if the player is 2 'tiles' from the destination.
        Returns:
        the path precision
      • enableRun

        protected void enableRun​(APIContext ctx)