Sha256: fe6a68a9bd9688b51cfd26e27bcabf05429b6e7a76ff8db988ba848c5ebdc75c

Contents?: true

Size: 609 Bytes

Versions: 6

Compression:

Stored size: 609 Bytes

Contents

module Example
  class ExampleController < GameMachine::Actor::Base
    include GameMachine
    include GameMachine::Commands
    include GameMachine::Actor::Development

    # This is our initializer method. It is called once on actor start.
    #
    def post_init(*args)
      # Just because
      GameMachine.logger.info "#{self.class.name} post_init called"
    end

    def on_receive(message)

      # Send message back to player who sent it
      commands.player.send_message(message.to_entity,message.player.id)
      GameMachine.logger.info("message sent to #{message.player.id}")
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
game_machine-1.0.4 games/example/lib/example_controller.rb
game_machine-1.0.2 games/example/lib/example_controller.rb
game_machine-0.0.11 games/example/lib/example_controller.rb
game_machine-0.0.10 games/example/lib/example_controller.rb
game_machine-0.0.9 games/example/lib/example_controller.rb
game_machine-0.0.8 games/example/lib/example_controller.rb