Module: Lich::GameBase::GameInstanceFactory

Defined in:
documented/games.rb

Overview

Factory for creating game-specific objects Factory for creating game-specific objects

Examples:

Creating a game instance

instance = GameInstanceFactory.create("GS")

Class Method Summary collapse

Class Method Details

.create(game_type) ⇒ GameInstance

Creates a game instance based on the game type

Examples:

instance = GameInstanceFactory.create("GS")

Parameters:

  • game_type (String)

    The type of game (e.g., “GS”, “DR”)

Returns:

Raises:

  • (NotImplementedError)

    If the game type is unknown



45
46
47
48
49
50
51
52
53
54
55
# File 'documented/games.rb', line 45

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