Class: Conreality::Object
- Inherits:
-
Object
- Object
- Conreality::Object
- Defined in:
- lib/conreality/object.rb
Overview
Represents a Conreality object.
Constant Summary collapse
- TABLE =
< Database::Row
:object
- KEY =
:uuid
Instance Attribute Summary collapse
-
#color ⇒ Integer
The object’s estimated color (as a 24-bit RGB value).
-
#group ⇒ Group
The group, if any, that the object belongs to.
-
#label ⇒ String
The object’s designated label.
-
#mass ⇒ Float
The object’s estimated mass (in kilograms).
-
#orientation ⇒ Float
The object’s current orientation (in radians relative to north).
-
#position ⇒ ?
The object’s current position (as 3D coordinates relative to its theater).
-
#radius ⇒ Float
The object’s determined radius (in meters).
-
#theater ⇒ Theater
The theater that the object is located in.
-
#type ⇒ Symbol
readonly
The object’s type.
-
#uuid ⇒ String
readonly
The object’s unique identifier.
Casts collapse
-
#as_asset ⇒ Asset
Returns this object cast to an asset.
-
#as_camera ⇒ Camera
Returns this object cast to a camera.
-
#as_player ⇒ Player
Returns this object cast to a player.
Predicates collapse
-
#is_asset? ⇒ Boolean
Checks whether this object is an asset.
-
#is_camera? ⇒ Boolean
Checks whether this object is a camera.
-
#is_player? ⇒ Boolean
Checks whether this object is a player.
-
#is_target? ⇒ Boolean
Checks whether this object is a target.
Messaging collapse
-
#send_message(text) ⇒ Message
The sent message.
Instance Method Summary collapse
-
#initialize(session, uuid) ⇒ Object
constructor
A new instance of Object.
-
#inspect ⇒ String
Returns a developer-friendly representation of this object.
Constructor Details
#initialize(session, uuid) ⇒ Object
Returns a new instance of Object.
73 74 75 76 |
# File 'lib/conreality/object.rb', line 73 def initialize(session, uuid) super(session) @uuid = uuid.to_s.freeze end |
Instance Attribute Details
#color ⇒ Integer
The object’s estimated color (as a 24-bit RGB value).
68 69 70 |
# File 'lib/conreality/object.rb', line 68 def color @color end |
#group ⇒ Group
The group, if any, that the object belongs to.
32 33 34 |
# File 'lib/conreality/object.rb', line 32 def group @group end |
#label ⇒ String
The object’s designated label.
38 39 40 |
# File 'lib/conreality/object.rb', line 38 def label @label end |
#mass ⇒ Float
The object’s estimated mass (in kilograms).
56 57 58 |
# File 'lib/conreality/object.rb', line 56 def mass @mass end |
#orientation ⇒ Float
The object’s current orientation (in radians relative to north).
50 51 52 |
# File 'lib/conreality/object.rb', line 50 def orientation @orientation end |
#position ⇒ ?
The object’s current position (as 3D coordinates relative to its theater).
44 45 46 |
# File 'lib/conreality/object.rb', line 44 def position @position end |
#radius ⇒ Float
The object’s determined radius (in meters).
62 63 64 |
# File 'lib/conreality/object.rb', line 62 def radius @radius end |
#theater ⇒ Theater
The theater that the object is located in.
26 27 28 |
# File 'lib/conreality/object.rb', line 26 def theater @theater end |
#type ⇒ Symbol (readonly)
The object’s type.
20 21 22 |
# File 'lib/conreality/object.rb', line 20 def type @type end |
#uuid ⇒ String (readonly)
The object’s unique identifier.
14 15 16 |
# File 'lib/conreality/object.rb', line 14 def uuid @uuid end |
Instance Method Details
#as_asset ⇒ Asset
Returns this object cast to an asset.
92 93 94 |
# File 'lib/conreality/object.rb', line 92 def as_asset Asset.new(@session, @uuid) end |
#as_camera ⇒ Camera
Returns this object cast to a camera.
100 101 102 |
# File 'lib/conreality/object.rb', line 100 def as_camera Camera.new(@session, @uuid) end |
#as_player ⇒ Player
Returns this object cast to a player.
108 109 110 |
# File 'lib/conreality/object.rb', line 108 def as_player Player.new(@session, @uuid) end |
#inspect ⇒ String
Returns a developer-friendly representation of this object.
82 83 84 |
# File 'lib/conreality/object.rb', line 82 def inspect sprintf("#<%s:%#0x(uuid: %s)>", self.class.name, self.__id__, @uuid) end |
#is_asset? ⇒ Boolean
Checks whether this object is an asset.
120 121 122 |
# File 'lib/conreality/object.rb', line 120 def is_asset? nil # TODO end |
#is_camera? ⇒ Boolean
Checks whether this object is a camera.
128 129 130 |
# File 'lib/conreality/object.rb', line 128 def is_camera? nil # TODO end |
#is_player? ⇒ Boolean
Checks whether this object is a player.
136 137 138 |
# File 'lib/conreality/object.rb', line 136 def is_player? nil # TODO end |
#is_target? ⇒ Boolean
Checks whether this object is a target.
144 145 146 |
# File 'lib/conreality/object.rb', line 144 def is_target? nil # TODO end |
#send_message(text) ⇒ Message
Returns the sent message.
155 156 157 158 159 |
# File 'lib/conreality/object.rb', line 155 def (text) @session.execute do |action| # FIXME action.(self, text) end end |