Class: GameMachine::Actor::Factory
- Inherits:
-
Object
- Object
- GameMachine::Actor::Factory
- Includes:
- JavaLib::IActorFactory
- Defined in:
- lib/game_machine/actor/factory.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create ⇒ Object
-
#initialize(klass, args) ⇒ Factory
constructor
A new instance of Factory.
Constructor Details
#initialize(klass, args) ⇒ Factory
Returns a new instance of Factory.
7 8 9 10 |
# File 'lib/game_machine/actor/factory.rb', line 7 def initialize(klass,args) @klass = klass @args = args end |
Class Method Details
.create ⇒ Object
30 31 |
# File 'lib/game_machine/actor/factory.rb', line 30 def self.create end |
Instance Method Details
#create ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/game_machine/actor/factory.rb', line 12 def create if @klass.respond_to?(:reload_on_change?) if @klass.reload_on_change? GameMachine.logger.info "Checking if #{@klass.name} should be reloaded" GameMachine::Actor::Reloadable.reload_if_changed(@klass.name) @klass = @klass.name.constantize end end actor = @klass.new if actor.respond_to?(:initialize_states) actor.initialize_states end if actor.respond_to?(:post_init) actor.post_init(*@args) end actor end |