Class: TyranoDsl::Elements::Character

Inherits:
Object
  • Object
show all
Defined in:
lib/tyrano_dsl/elements/character.rb

Overview

A declared character

Constant Summary collapse

CHARACTER_DIRECTORY =
File.join('data', 'fgimage', 'chara')

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, declared_stances, index) ⇒ Character

Returns a new instance of Character.

Parameters:

  • name (String)
  • declared_stances (String)
  • index (Integer)


22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/tyrano_dsl/elements/character.rb', line 22

def initialize(name, declared_stances, index)
  @name = name
  @stances = stances
  @index = index
  @stances = {}

  @stances_target_long_files_names = {}
  @stance_target_short_file_names = {}
  declared_stances.each_pair do |stance_name, stance_file|
    short_file_name = File.join(index.to_s,
                                "#{@stances.length}#{File.extname(stance_file)}")
    long_file_name = File.join(
        CHARACTER_DIRECTORY, short_file_name)
    stance = TyranoDsl::Elements::Stance.new(
        stance_name,
        stance_file,
        short_file_name,
        long_file_name)
    @stances[stance_name] = stance

    if stance_name == :default
      @default_stance = stance
      @default_stance_target_short_file_name = short_file_name
    end
  end
end

Instance Attribute Details

#default_stanceTyranoDsl::Elements::Stance (readonly)



17
18
19
# File 'lib/tyrano_dsl/elements/character.rb', line 17

def default_stance
  @default_stance
end

#indexIndex (readonly)

Returns:

  • (Index)


13
14
15
# File 'lib/tyrano_dsl/elements/character.rb', line 13

def index
  @index
end

#nameString (readonly)

Returns:

  • (String)


11
12
13
# File 'lib/tyrano_dsl/elements/character.rb', line 11

def name
  @name
end

#stancesHash{String => TyranoDsl::Elements::Stance} (readonly)

Returns:



15
16
17
# File 'lib/tyrano_dsl/elements/character.rb', line 15

def stances
  @stances
end