protected override void OnChangeIndex(int index)
    {
        _currentIndex = index;
        int songIndex = index - _rhythmController.Level.BeatsBeforeLevelStarts;

        if (index < 0)
        {
            return;
        }

        _rhythmController.SetCurrentBeat(index);

        DestroyLasersAndUI();

        if (songIndex >= 0)
        {
            _songController.AudioPlayer.PlayAudioAt(SongController.GetSongTime(index), _rhythmController.SecondsPerBeat);
        }

        if (index - 18 >= 0)
        {
            if (_musicLevelSetup.musicLevel.GetBeat(index - 18).spawnLaser)
            {
                _laserController.CreateLaser(_laserController.hitLaser, _musicLevelSetup.musicLevel.GetBeat(index - 18).laser.GetLaserPart(LaserTypes.HitLaser), index - 18, false);
            }
        }

        if (_musicLevelSetup.musicLevel.GetBeat(index).spawnLaser)
        {
            _laserController.CreateLaser(_laserController.preLaser, _musicLevelSetup.musicLevel.GetBeat(index).laser.GetLaserPart(LaserTypes.PreLaser), index, false);
        }
    }
Exemplo n.º 2
0
    protected override void OnBeat(int beatIndex)
    {
        float value = Mathf.Round(SongController.GetSongTime(beatIndex) * 100f) / 100f;

        _text.text = _timeText + " " + value;
    }
Exemplo n.º 3
0
    private void Update()
    {
        TimeSpan timeSpan = TimeSpan.FromSeconds(songController.GetSongTime());

        time.text = string.Format("{0:D2}:{1:D2}", timeSpan.Minutes, timeSpan.Seconds);
    }