Sha256: 56473e1b91cf25451c2dea31644fc2d576448c00921df1226a5f5a32c6b4e8b6

Contents?: true

Size: 798 Bytes

Versions: 6

Compression:

Stored size: 798 Bytes

Contents

module GameMachine
  module Actor

    class Factory
      include JavaLib::IActorFactory

      def initialize(klass,args)
        @klass = klass
        @args = args
      end

      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

      def self.create
      end

    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
game_machine-1.0.4 lib/game_machine/actor/factory.rb
game_machine-1.0.2 lib/game_machine/actor/factory.rb
game_machine-0.0.11 lib/game_machine/actor/factory.rb
game_machine-0.0.10 lib/game_machine/actor/factory.rb
game_machine-0.0.9 lib/game_machine/actor/factory.rb
game_machine-0.0.8 lib/game_machine/actor/factory.rb