Class: ProconBypassMan::AnalogStickTiltingPowerScaler::PowerChunk
- Inherits:
-
Object
- Object
- ProconBypassMan::AnalogStickTiltingPowerScaler::PowerChunk
- Defined in:
- lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
Instance Method Summary collapse
-
#initialize(hypotenuses) ⇒ PowerChunk
constructor
A new instance of PowerChunk.
- #moving_power ⇒ Object
- #tilting?(threshold: DEFAULT_THRESHOLD, current_position_x:, current_position_y:) ⇒ Boolean
Constructor Details
#initialize(hypotenuses) ⇒ PowerChunk
Returns a new instance of PowerChunk.
5 6 7 |
# File 'lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb', line 5 def initialize(hypotenuses) @hypotenuses = hypotenuses end |
Instance Method Details
#moving_power ⇒ Object
9 10 11 12 13 |
# File 'lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb', line 9 def moving_power max = @hypotenuses.max min = @hypotenuses.min moving_power = (max - min).abs end |
#tilting?(threshold: DEFAULT_THRESHOLD, current_position_x:, current_position_y:) ⇒ Boolean
16 17 18 19 20 21 22 23 |
# File 'lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb', line 16 def tilting?(threshold: DEFAULT_THRESHOLD, current_position_x: , current_position_y: ) # スティックがニュートラルな時 if (-200..200).include?(current_position_x) && (-200..200).include?(current_position_y) return false end moving_power >= threshold end |