private void Start() { oCurrentScale = this.transform.localScale; oMaxScale = oCurrentScale.x * oChangeScaleCoef + oCurrentScale.x; oMinScale = oCurrentScale.x - oCurrentScale.x * oChangeScaleCoef; tempScaleCoefArray = new float[2]; pScaleCoefArray = new float[2]; LinearCoefSelection(AudioAnalysis.GetMaxSoundCoef(), AudioAnalysis.GetMinSoundCoef(), oMaxScale, oMinScale, pScaleCoefArray); }
private float GetScaleSoundHigher(float soundValue) { float lowBorder, highBorder; float minSoundCoef = AudioAnalysis.GetMinSoundCoef(); float maxSoundCoef = AudioAnalysis.GetMaxSoundCoef(); float x = soundValue / maxSoundCoef; if (soundValue % maxSoundCoef > 0) { x++; } highBorder = (int)x * maxSoundCoef; lowBorder = (int)x * minSoundCoef; LinearCoefSelection(highBorder, lowBorder, oMaxScale, oMinScale, tempScaleCoefArray); return(UpdateValueWithLinearCoef(tempScaleCoefArray, soundValue)); }
private float CountNewScaleValue(float soundValue) { if (soundValue > AudioAnalysis.GetMaxSoundCoef()) { //return GetScaleSoundHigher(soundValue); return(0); } else if (soundValue < AudioAnalysis.GetMinSoundCoef()) { return(0); } else { return(UpdateValueWithLinearCoef(pScaleCoefArray, soundValue)); } }