Class: Conreality::Object

Inherits:
Database::Row show all
Defined in:
lib/conreality/object.rb

Overview

Represents a Conreality object.

Direct Known Subclasses

Asset, Camera, Player

Constant Summary collapse

TABLE =
:object
KEY =
:uuid

Constants inherited from Database::Row

Database::Row::SCHEMA

Instance Attribute Summary collapse

Casts collapse

Predicates collapse

Messaging collapse

Instance Method Summary collapse

Methods inherited from Database::Row

attr_accessor, attr_reader, attr_wrapper, attr_writer, #get, #key, key_attr, #set!, table_name

Constructor Details

#initialize(client, uuid) ⇒ Object


71
72
73
74
# File 'lib/conreality/object.rb', line 71

def initialize(client, uuid)
  super(client)
  @uuid = uuid.to_s
end

Instance Attribute Details

#colorInteger

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


66
67
68
# File 'lib/conreality/object.rb', line 66

def color
  @color
end

#groupGroup

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


30
31
32
# File 'lib/conreality/object.rb', line 30

def group
  @group
end

#labelString

The object's designated label.


36
37
38
# File 'lib/conreality/object.rb', line 36

def label
  @label
end

#massFloat

The object's estimated mass (in kilograms).


54
55
56
# File 'lib/conreality/object.rb', line 54

def mass
  @mass
end

#orientationFloat

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


48
49
50
# File 'lib/conreality/object.rb', line 48

def orientation
  @orientation
end

#position?

The object's current position (as 3D coordinates relative to its theater).


42
43
44
# File 'lib/conreality/object.rb', line 42

def position
  @position
end

#radiusFloat

The object's determined radius (in meters).


60
61
62
# File 'lib/conreality/object.rb', line 60

def radius
  @radius
end

#theaterTheater

The theater that the object is located in.


24
25
26
# File 'lib/conreality/object.rb', line 24

def theater
  @theater
end

#typeSymbol (readonly)

The object's type.


18
19
20
# File 'lib/conreality/object.rb', line 18

def type
  @type
end

#uuidString (readonly)

The object's unique identifier.


12
13
14
# File 'lib/conreality/object.rb', line 12

def uuid
  @uuid
end

Instance Method Details

#as_assetAsset

Returns this object cast to an asset.


90
91
92
# File 'lib/conreality/object.rb', line 90

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

#as_cameraCamera

Returns this object cast to a camera.


98
99
100
# File 'lib/conreality/object.rb', line 98

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

#as_playerPlayer

Returns this object cast to a player.


106
107
108
# File 'lib/conreality/object.rb', line 106

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

#inspectString

Returns a developer-friendly representation of this object.


80
81
82
# File 'lib/conreality/object.rb', line 80

def inspect
  sprintf("#<%s:%#0x(uuid: %s)>", self.class.name, self.__id__, @uuid)
end

#is_asset?Boolean

Checks whether this object is an asset.


118
119
120
# File 'lib/conreality/object.rb', line 118

def is_asset?
  nil # TODO
end

#is_camera?Boolean

Checks whether this object is a camera.


126
127
128
# File 'lib/conreality/object.rb', line 126

def is_camera?
  nil # TODO
end

#is_player?Boolean

Checks whether this object is a player.


134
135
136
# File 'lib/conreality/object.rb', line 134

def is_player?
  nil # TODO
end

#is_target?Boolean

Checks whether this object is a target.


142
143
144
# File 'lib/conreality/object.rb', line 142

def is_target?
  nil # TODO
end

#send_message(text) ⇒ Message


153
154
155
156
157
# File 'lib/conreality/object.rb', line 153

def send_message(text)
  @client.open do |transaction| # FIXME
    transaction.send_message(self, text)
  end
end