Class: NetObj::PlayerInput

Inherits:
SnapItemBase show all
Defined in:
lib/snapshot/items/player_input.rb

Instance Attribute Summary collapse

Attributes inherited from SnapItemBase

#id, #name, #notes

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SnapItemBase

#init_hash, #init_raw, #init_unpacker, #to_a, #to_h, #to_s, #validate

Constructor Details

#initialize(hash_or_raw) ⇒ PlayerInput

Returns a new instance of PlayerInput.



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/snapshot/items/player_input.rb', line 12

def initialize(hash_or_raw)
  @field_names = %i[
    direction
    target_x
    target_y
    jump
    fire
    hook
    player_flags
    wanted_weapon
    next_weapon
    prev_weapon
  ]
  super
end

Instance Attribute Details

#directionObject

Returns the value of attribute direction.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def direction
  @direction
end

#fireObject

Returns the value of attribute fire.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def fire
  @fire
end

#hookObject

Returns the value of attribute hook.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def hook
  @hook
end

#jumpObject

Returns the value of attribute jump.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def jump
  @jump
end

#next_weaponObject

Returns the value of attribute next_weapon.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def next_weapon
  @next_weapon
end

#player_flagsObject

Returns the value of attribute player_flags.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def player_flags
  @player_flags
end

#prev_weaponObject

Returns the value of attribute prev_weapon.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def prev_weapon
  @prev_weapon
end

#target_xObject

Returns the value of attribute target_x.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def target_x
  @target_x
end

#target_yObject

Returns the value of attribute target_y.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def target_y
  @target_y
end

#wanted_weaponObject

Returns the value of attribute wanted_weapon.



7
8
9
# File 'lib/snapshot/items/player_input.rb', line 7

def wanted_weapon
  @wanted_weapon
end

Class Method Details

.match_type?(type) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'lib/snapshot/items/player_input.rb', line 28

def self.match_type?(type)
  type == NETOBJTYPE_PLAYERINPUT
end