Class: ShatteredController::State

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

Overview

State is the entry point for your shattered game.

States define the actors, communications between the actors, and control the camera. You can choose your starting state in config/environment.rb

Instance Attribute Summary

Attributes inherited from Base

#model, #view

Instance Method Summary collapse

Methods inherited from Base

#disabled?, #method_missing, #unload!, #update_timer, #update_timers

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class ShatteredController::Base

Instance Method Details

#activate_stateObject

:nodoc:



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

def activate_state #:nodoc:
  ShatteredSupport::Configuration.environment[:state] = self
end

#camera(*args) ⇒ Object

Returns the camera used in the state. See ShatteredController::ClassMethods#camera



49
50
51
52
53
54
# File 'lib/state.rb', line 49

def camera(*args)
  if args.length == 0
    return @camera ||= Runner.environment[:camera]
  end
  call_object_function_for_each_key(:camera, args[0])
end

#sky=(type, material) ⇒ Object

:nodoc:



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

def sky=(type, material) #:nodoc:
  Runner.environment[:scene].send("setSky#{type.to_s.capitalize}",material)
end