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