Sha256: 4ea6e0c87c81e2756f044f09d3f4f0fe346e0b8347204236261515b2b881e861

Contents?: true

Size: 498 Bytes

Versions: 3

Compression:

Stored size: 498 Bytes

Contents

require_relative 'world_object'

module Woyo

class Character < WorldObject

  attributes :name, :description

  def world
    @world ||= context if context.is_a? World
  end

  def location
    @location ||= context if context.is_a? Location
  end

  def me
    self
  end

  def go way_or_id
    id = way_or_id.kind_of?(Way) ? way_or_id.id : way_or_id
    way = @location.ways[id]
    @location.characters.delete me.id
    @location = way.to
    @location.characters[me.id] = me
  end

end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
woyo-world-0.0.2 lib/woyo/world/character.rb
woyo-world-0.0.1 lib/woyo/world/character.rb
woyo-world-0.0.1.pre2 lib/woyo/world/character.rb