Sha256: 212f97c561aee89fb42e28eccc3a04ecef67b9d98a884d47756085de1330aa17

Contents?: true

Size: 827 Bytes

Versions: 2

Compression:

Stored size: 827 Bytes

Contents

class Portal < Entity
  attr_accessor :destination
  #def initialize
  #	super
  #	@destination = nil
  #end
  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
  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

2 entries across 2 versions & 1 rubygems

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