Sha256: 703538908e95cb34015ecac3d51d982bbd9853e0e6afd955c50e44e9322aa792

Contents?: true

Size: 771 Bytes

Versions: 12

Compression:

Stored size: 771 Bytes

Contents

class ProconBypassMan::AnalogStickTiltingPowerScaler
  DEFAULT_THRESHOLD = 500

  class PowerChunk
    def initialize(hypotenuses)
      @hypotenuses = hypotenuses
    end

    def moving_power
      max = @hypotenuses.max
      min = @hypotenuses.min
      moving_power = (max - min).abs
    end

    # @return [Boolean]
    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
  end

  # @param [Array<Float>] hypotenuses
  # @return [PowerChunk]
  def calculate(hypotenuses)
    PowerChunk.new(hypotenuses)
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
procon_bypass_man-0.3.12 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.11 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.10 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.9 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.8.1 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.8 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.7 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.6 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.5 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.4 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.3.1 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb
procon_bypass_man-0.3.3 lib/procon_bypass_man/support/analog_stick_hypotenuse_tilting_power_scaler.rb