Class: Camera

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

Instance Method Summary collapse

Constructor Details

#initialize(api) ⇒ Camera

Returns a new instance of Camera.



3
4
5
# File 'lib/camera.rb', line 3

def initialize(api)
  @api = api
end

Instance Method Details

#mode(mode, x = nil, y = nil, z = nil) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/camera.rb', line 7

def mode(mode,x=nil,y=nil,z=nil)
  case mode
  when :normal then command = "setNormal()"
  when :third_person then command = "setThirdPerson()"
  when :fixed then command = "setFixed()"
  when :position then command = "setPos(#{x},#{y},#{z})"
  else raise RuntimeError.new("valid camera settings are: :normal, :third_person, :fixed, and :position")
  end
  
  @api.send("camera.mode.#{command}")
end