Sha256: 8631649647eb7dcfad98f80d87f0684119578cdbe915ffd90f8cb5e4f05fecd4

Contents?: true

Size: 734 Bytes

Versions: 1

Compression:

Stored size: 734 Bytes

Contents

class Portal < Entity
  attr_accessor :destination
  def find_reverse
    rev = Portal.reverse(self.name)
    if rev != nil
      destination.children.that_are(Portal).each { |c|
        if c.name == rev
          return c
        end
      }
    end
    nil
  end
  def self.reverse(direction)
    case direction.downcase
      when "north"
        "south"
      when "south"
        "north"
      when "west"
        "east"
      when "east"
        "west"
      when "northwest"
        "southeast"
      when "southeast"
        "northwest"
      when "northeast"
        "southwest"
      when "southwest"
        "northeast"
      when "up"
        "down"
      when "down"
        "up"
      else
        nil
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
gamefic-0.2.0 lib/gamefic/import/basics/entities/portal.rb