Class: Gamefic::Engine::Web

Inherits:
Base
  • Object
show all
Defined in:
lib/gamefic-sdk/platform/web/engine.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#userObject (readonly)

Returns the value of attribute user.



12
13
14
# File 'lib/gamefic-sdk/platform/web/engine.rb', line 12

def user
  @user
end

Instance Method Details

#post_initializeObject



14
15
16
# File 'lib/gamefic-sdk/platform/web/engine.rb', line 14

def post_initialize
  self.user_class = Gamefic::User::Web
end

#receive(input) ⇒ Object



31
32
33
34
# File 'lib/gamefic-sdk/platform/web/engine.rb', line 31

def receive input
  @user.character.queue.push input unless input.nil?
  update
end

#runObject



18
19
20
21
22
23
# File 'lib/gamefic-sdk/platform/web/engine.rb', line 18

def run
  connect
  plot.introduce @user.character
  plot.ready
  @user.update
end

#turnObject



25
26
27
28
29
# File 'lib/gamefic-sdk/platform/web/engine.rb', line 25

def turn
  @plot.ready
  @user.update
  update unless @user.character.queue.empty?
end