Class: Conreality::Object

Inherits:
Object
  • Object
show all
Defined in:
lib/conreality/object.rb

Overview

Represents a Conreality object.

Direct Known Subclasses

Asset, Camera, Player

Constant Summary collapse

TABLE =

< Database::Row

:object
KEY =
:uuid

Instance Attribute Summary collapse

Casts collapse

Predicates collapse

Messaging collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, uuid) ⇒ Object

Returns a new instance of Object.

Parameters:



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

#colorInteger

The object’s estimated color (as a 24-bit RGB value).

Returns:

  • (Integer)


68
69
70
# File 'lib/conreality/object.rb', line 68

def color
  @color
end

#groupGroup

The group, if any, that the object belongs to.

Returns:

  • (Group)


32
33
34
# File 'lib/conreality/object.rb', line 32

def group
  @group
end

#labelString

The object’s designated label.

Returns:

  • (String)


38
39
40
# File 'lib/conreality/object.rb', line 38

def label
  @label
end

#massFloat

The object’s estimated mass (in kilograms).

Returns:

  • (Float)


56
57
58
# File 'lib/conreality/object.rb', line 56

def mass
  @mass
end

#orientationFloat

The object’s current orientation (in radians relative to north).

Returns:

  • (Float)


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).

Returns:

  • (?)


44
45
46
# File 'lib/conreality/object.rb', line 44

def position
  @position
end

#radiusFloat

The object’s determined radius (in meters).

Returns:

  • (Float)


62
63
64
# File 'lib/conreality/object.rb', line 62

def radius
  @radius
end

#theaterTheater

The theater that the object is located in.

Returns:



26
27
28
# File 'lib/conreality/object.rb', line 26

def theater
  @theater
end

#typeSymbol (readonly)

The object’s type.

Returns:

  • (Symbol)


20
21
22
# File 'lib/conreality/object.rb', line 20

def type
  @type
end

#uuidString (readonly)

The object’s unique identifier.

Returns:

  • (String)


14
15
16
# File 'lib/conreality/object.rb', line 14

def uuid
  @uuid
end

Instance Method Details

#as_assetAsset

Returns this object cast to an asset.

Returns:



92
93
94
# File 'lib/conreality/object.rb', line 92

def as_asset
  Asset.new(@session, @uuid)
end

#as_cameraCamera

Returns this object cast to a camera.

Returns:



100
101
102
# File 'lib/conreality/object.rb', line 100

def as_camera
  Camera.new(@session, @uuid)
end

#as_playerPlayer

Returns this object cast to a player.

Returns:



108
109
110
# File 'lib/conreality/object.rb', line 108

def as_player
  Player.new(@session, @uuid)
end

#inspectString

Returns a developer-friendly representation of this object.

Returns:

  • (String)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


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.

Returns:

  • (Boolean)


144
145
146
# File 'lib/conreality/object.rb', line 144

def is_target?
  nil # TODO
end

#send_message(text) ⇒ Message

Returns the sent message.

Parameters:

  • text (String)

    the message contents as text

Returns:



155
156
157
158
159
# File 'lib/conreality/object.rb', line 155

def send_message(text)
  @session.execute do |action| # FIXME
    action.send_message(self, text)
  end
end