Class: Beefdump::Map::Object
- Inherits:
-
Object
- Object
- Beefdump::Map::Object
- Defined in:
- lib/beefdump/map/object.rb
Instance Attribute Summary collapse
-
#blueprint ⇒ Object
readonly
Returns the value of attribute blueprint.
-
#height ⇒ Object
readonly
Returns the value of attribute height.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
-
#width ⇒ Object
readonly
Returns the value of attribute width.
-
#x ⇒ Object
readonly
Returns the value of attribute x.
-
#y ⇒ Object
readonly
Returns the value of attribute y.
Instance Method Summary collapse
-
#initialize(object_data) ⇒ Object
constructor
A new instance of Object.
- #is_at?(x, y) ⇒ Boolean
Constructor Details
#initialize(object_data) ⇒ Object
Returns a new instance of Object.
6 7 8 9 10 |
# File 'lib/beefdump/map/object.rb', line 6 def initialize(object_data) load_object_attributes!(object_data) load_properties!(object_data["properties"]) end |
Instance Attribute Details
#blueprint ⇒ Object (readonly)
Returns the value of attribute blueprint.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def blueprint @blueprint end |
#height ⇒ Object (readonly)
Returns the value of attribute height.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def height @height end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def name @name end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def properties @properties end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def type @type end |
#width ⇒ Object (readonly)
Returns the value of attribute width.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def width @width end |
#x ⇒ Object (readonly)
Returns the value of attribute x.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def x @x end |
#y ⇒ Object (readonly)
Returns the value of attribute y.
4 5 6 |
# File 'lib/beefdump/map/object.rb', line 4 def y @y end |
Instance Method Details
#is_at?(x, y) ⇒ Boolean
12 13 14 |
# File 'lib/beefdump/map/object.rb', line 12 def is_at?(x, y) self.x >= x && self.x + self.width <= x && self.y >= y && self.y + self.height <= y end |