Module: Lich::GameBase::GameInstanceFactory

Defined in:
documented/games.rb

Overview

Factory for creating game-specific objects

Class Method Summary collapse

Class Method Details

.create(game_type) ⇒ Lich::Gemstone::GameInstance, ...

Creates a game-specific instance based on the game type identifier.

Examples:

GameInstanceFactory.create("GS") #=> Gemstone::GameInstance

Parameters:

  • game_type (String)

    the game identifier, matching /^GS/ for GemStone or /^DR/ for DragonRealms

Returns:



166
167
168
169
170
171
172
173
174
175
176
# File 'documented/games.rb', line 166

def self.create(game_type)
  case game_type
  when /^GS/
    Gemstone::GameInstance.new
  when /^DR/
    DragonRealms::GameInstance.new
  else
    # Default to a basic implementation if game type is unknown
    GameInstance::Base.new
  end
end