Sha256: ac647ca06d4fc773a095c24db5bd68133e3bef7c0739d3677101f642cbd11118
Contents?: true
Size: 570 Bytes
Versions: 6
Compression:
Stored size: 570 Bytes
Contents
module GameMachine module Helpers module StateMachine def load_state(id, &block) @actor_states[id] ||= @initial_state self.state = @actor_states[id] if block_given? yield save_state(id) end end def save_state(id) @actor_states[id] = self.state end def destroy_state(id) @actor_states.delete(id) end def initialize_states @actor_states = {} initialize_state_machines @initial_state = self.state.dup end end end end
Version data entries
6 entries across 6 versions & 1 rubygems