public void CreateNewLaser(LR_Beat beat, int index)
 {
     if (index - 18 >= 0)
     {
         _musicLevelSetup.musicLevel.SetBeat(beat, index - 18);
         _laserController.CreateLaser(_laserController.hitLaser, _musicLevelSetup.musicLevel.GetBeat(index - 18).laser.GetLaserPart(LaserTypes.HitLaser), index, false);
         _musicLevelEditor.UpdateIndex();
     }
 }
Esempio n. 2
0
    public override void Activate()
    {
        base.Activate();

        LR_Beat beat = new LR_Beat
        {
            spawnLaser = true
        };

        beat.laser.preLaser.radius         = 5;
        beat.laser.preLaser.startColor     = Color.green;
        beat.laser.hitLaser.radius         = 5;
        beat.laser.hitLaser.startColor     = Color.red;
        beat.laser.hitLaser.forceFactor    = 2;
        beat.laser.hitLaser.forceDirection = LaserPartData.ForceDirections.backward;
        _spawning.CreateNewLaser(beat, musicLevelEditor.CurrentIndex);
    }
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.C))
        {
            LR_Beat beat = new LR_Beat
            {
                spawnLaser = true
            };
            beat.laser.preLaser.radius         = 5;
            beat.laser.preLaser.startColor     = Color.green;
            beat.laser.hitLaser.radius         = 5;
            beat.laser.hitLaser.startColor     = Color.red;
            beat.laser.hitLaser.forceFactor    = 2;
            beat.laser.hitLaser.forceDirection = LaserPartData.ForceDirections.backward;
            CreateNewLaser(beat, _currentIndex);
        }

        if (Input.GetKeyDown(KeyCode.Space) && _currentIndex >= _rhythmController.Level.BeatsBeforeLevelStarts)
        {
            if (_musicLevelEditor.enabled)
            {
                DestroyLasersAndUI();

                GetComponent <RhythmController>().StartLevelAt(_currentIndex);
                _songController.AudioPlayer.PlayAudioAt(_rhythmController.SecondsPerBeat * 0.25f * (_currentIndex - _rhythmController.Level.BeatsBeforeLevelStarts));

                _musicLevelEditor.enabled = false;
            }
            else
            {
                _musicLevelEditor.UpdateIndex();
                GetComponent <RhythmController>().StopLevel();
                _songController.AudioPlayer.Stop();

                _musicLevelEditor.enabled = true;
            }
        }
    }