internal InGameNote Initialize(MusicBoard musicBoard) { _masterMusicBoard = musicBoard; Activated = true; CurrentRank = ValidationRank.Null; _spriteComp.sprite = _brokenState; _startPosition = transform.position; _timer = new SpecialCountDown(_masterMusicBoard.MovementDuration); _destinationPosition = new Vector3(_masterMusicBoard.ValidationXPosition, _startPosition.y, _startPosition.z); return(this); }
public void Init() { // Calculate number of samples between each beat. float audioBpm = audioSource.GetComponent <MusicProvider>().CurrentSheet.BPM; _manager = FindObjectOfType <MusicBoard>(); BeatSynchronizer.OnAudioStart += StartBeatCheck; samplePeriod = (60f / (audioBpm * BeatDecimalValues.values[(int)beatValue])) * audioSource.clip.frequency; if (beatOffset != BeatValue.None) { sampleOffset = (60f / (audioBpm * BeatDecimalValues.values[(int)beatOffset])) * audioSource.clip.frequency; if (negativeBeatOffset) { sampleOffset = samplePeriod - sampleOffset; } } samplePeriod *= beatScalar; sampleOffset *= beatScalar; nextBeatSample = 0f; }