Class: GameMachine::Handlers::Game

Inherits:
Actor::Base
  • Object
show all
Includes:
Commands
Defined in:
lib/game_machine/handlers/game.rb

Constant Summary

Constants inherited from Actor::Base

Actor::Base::ON_RECEIVE_HOOKS

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Commands

#commands

Methods inherited from Actor::Base

aspect, aspects, find, find_by_address, find_distributed, find_distributed_local, find_remote, hashring, local_path, model_filter, #onReceive, player_controller, #receive_message, #schedule_message, #sender, set_player_controller

Instance Attribute Details

#destinationsObject (readonly)

Returns the value of attribute destinations.



6
7
8
# File 'lib/game_machine/handlers/game.rb', line 6

def destinations
  @destinations
end

#game_message_routesObject (readonly)

Returns the value of attribute game_message_routes.



6
7
8
# File 'lib/game_machine/handlers/game.rb', line 6

def game_message_routes
  @game_message_routes
end

Instance Method Details

#on_receive(message) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/game_machine/handlers/game.rb', line 13

def on_receive(message)
  if message.is_a?(MessageLib::ClientMessage)
    if message.get_entity_list
      dispatch_entities(message.get_entity_list)
    end
  else
    unhandled(message)
  end
end

#post_init(*args) ⇒ Object



7
8
9
10
# File 'lib/game_machine/handlers/game.rb', line 7

def post_init(*args)
  @game_message_routes = Routes.instance.game_message_routes
  @destinations = {}
end