Sha256: a96bdc4670c76ff8357b4b4fee298b4d45638014d7f7c32cf4232ad12438ecfd

Contents?: true

Size: 662 Bytes

Versions: 6

Compression:

Stored size: 662 Bytes

Contents

module GameMachine
  module Navigation
    class Path

      attr_accessor :path, :current_location
      attr_reader :current_point
      def initialize(path,current_location)
        @path = path
        @current_point = path.first
        @current_location = current_location
      end

      def set_path(path)
        @path = path
        @current_point = path.first
      end

      def next_point
        if point_reached?
          @current_point = path.shift
        end
        @current_point
      end

      def point_reached?
        return true if current_point.nil?
        current_location.distance(current_point) < 1
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
game_machine-1.0.4 lib/game_machine/navigation/path.rb
game_machine-1.0.2 lib/game_machine/navigation/path.rb
game_machine-0.0.11 lib/game_machine/navigation/path.rb
game_machine-0.0.10 lib/game_machine/navigation/path.rb
game_machine-0.0.9 lib/game_machine/navigation/path.rb
game_machine-0.0.8 lib/game_machine/navigation/path.rb