Пример #1
0
    public static BeatmapObstacleContainer SpawnObstacle(BeatmapObstacle data, AudioTimeSyncController atsc, ref GameObject prefab, ref ObstacleAppearanceSO appearanceSO)
    {
        BeatmapObstacleContainer container = Instantiate(prefab).GetComponent <BeatmapObstacleContainer>();

        container.obstacleData       = data;
        container.obstacleAppearance = appearanceSO;
        container.atsc = atsc;
        appearanceSO.SetObstacleAppearance(container);
        return(container);
    }
Пример #2
0
 public static void ResetTimeSync(AudioTimeSyncController timeSync, float newTimeScale, AudioTimeSyncController.InitData newData)
 {
     timeSync.SetPrivateField("_timeScale", newTimeScale);
     timeSync.SetPrivateField("_startSongTime", timeSync.songTime);
     timeSync.SetPrivateField("_audioStartTimeOffsetSinceStart",
                              timeSync.GetProperty <float>("timeSinceStart") - (timeSync.songTime + newData.songTimeOffset));
     timeSync.SetPrivateField("_fixingAudioSyncError", false);
     timeSync.SetPrivateField("_playbackLoopIndex", 0);
     timeSync.audioSource.pitch = newTimeScale;
 }
Пример #3
0
    public override void Redo(BeatmapActionContainer.BeatmapActionParams param)
    {
        AudioTimeSyncController atsc = BeatmapObjectContainerCollection.GetAnyCollection().AudioTimeSyncController;
        float beatTime = atsc.CurrentBeat;

        atsc.MoveToTimeInBeats(time);
        param.selection.Paste(false);
        atsc.MoveToTimeInBeats(beatTime);
        param.tracksManager.RefreshTracks();
    }
Пример #4
0
 private void LoadGameObjects()
 {
     levelFailController = Resources.FindObjectsOfTypeAll <StandardLevelFailedController>().LastOrDefault();
     spawnController     = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().LastOrDefault();
     spawnMovementData   = spawnController.GetField <BeatmapObjectSpawnMovementData, BeatmapObjectSpawnController>("_beatmapObjectSpawnMovementData");
     callbackController  = spawnController.GetField <BeatmapCallbacksController, BeatmapObjectSpawnController>("_beatmapCallbacksController");
     soundEffectManager  = Resources.FindObjectsOfTypeAll <NoteCutSoundEffectManager>().LastOrDefault();
     audioTimeSync       = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().LastOrDefault();
     songAudio           = audioTimeSync.GetField <AudioSource, AudioTimeSyncController>("_audioSource");
 }
Пример #5
0
 public virtual bool Init(CameraPlusBehaviour cameraPlus)
 {
     if (_audioTimeSyncController == null)
     {
         _audioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
     }
     _cameraPlus = cameraPlus;
     Plugin.Instance.ActiveSceneChanged += OnActiveSceneChanged;
     return(LoadCameraData(cameraPlus.Config.movementScriptPath));
 }
Пример #6
0
        ////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////

        /// <summary>
        /// Called every frames
        /// </summary>
        private void Update()
        {
            if (m_AudioTimeSyncController == null || !m_AudioTimeSyncController)
            {
                m_AudioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
            }

            if (SDK.Game.Logic.ActiveScene != SDK.Game.Logic.SceneType.Playing ||
                m_AudioTimeSyncController == null ||
                !m_AudioTimeSyncController)
            {
                GameObject.Destroy(gameObject);
                return;
            }

            if (m_AudioTimeSyncController.songTime == 0f)
            {
                return;
            }

            GameObject l_Object = null;

            /// BTS
            l_Object = Resources.FindObjectsOfTypeAll <GameObject>().FirstOrDefault(x => x.name == "MagicDoorSprite");
            if (l_Object != null)
            {
                l_Object.GetComponent <SpriteRenderer>().enabled = false;
                GameObject.Destroy(gameObject);
                return;
            }

            /// LinkinPark
            l_Object = Resources.FindObjectsOfTypeAll <GameObject>().FirstOrDefault(x => x.name == "LinkinParkTextLogoL");
            if (l_Object != null)
            {
                l_Object.GetComponent <SpriteRenderer>().enabled = false;

                l_Object = Resources.FindObjectsOfTypeAll <GameObject>().FirstOrDefault(x => x.name == "LinkinParkTextLogoR");
                if (l_Object != null)
                {
                    l_Object.GetComponent <SpriteRenderer>().enabled = false;
                }

                l_Object = Resources.FindObjectsOfTypeAll <GameObject>().FirstOrDefault(x => x.name == "Logo" && x.transform.parent.name == "Environment");
                if (l_Object != null)
                {
                    l_Object.GetComponent <SpriteRenderer>().enabled = false;
                }

                GameObject.Destroy(gameObject);
                return;
            }

            GameObject.Destroy(gameObject);
        }
Пример #7
0
        void Update()
        {
            if (_audioTimeSync == false)
            {
                _audioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
                return;
            }

            _timeMesh.text    = $"{Math.Floor(_audioTimeSync.songTime / 60):N0}:{Math.Floor(_audioTimeSync.songTime % 60):00}";
            _image.fillAmount = _audioTimeSync.songTime / _audioTimeSync.songLength;
        }
Пример #8
0
 public CountersData()
 {
     BOM                     = Resources.FindObjectsOfTypeAll <BeatmapObjectManager>().First();
     ScoreController         = Resources.FindObjectsOfTypeAll <ScoreController>().First();
     PlayerController        = Resources.FindObjectsOfTypeAll <PlayerController>().First();
     AudioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().First();
     PlayerData              = Resources.FindObjectsOfTypeAll <PlayerDataModel>().First();
     ModifiersData           = Resources.FindObjectsOfTypeAll <GameplayModifiersModelSO>().First();
     GCSSD                   = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData; //By the time all of these load, so should GCSSD.
     Is360Or90Level          = Resources.FindObjectsOfTypeAll <FlyingGameHUDRotation>().Any(x => x.isActiveAndEnabled);
 }
        IEnumerator FindScoreController()
        {
            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <ScoreController>().Any()));

            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().Any()));

            ScoreController         scoreController    = Resources.FindObjectsOfTypeAll <ScoreController>().First();
            AudioTimeSyncController timeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().First();

            scoreController.noteWasCutEvent += OnNoteHit;
        }
Пример #10
0
        static void Postfix(AudioTimeSyncController __instance)
        {
#if DEBUG
            Plugin.Log.Info("AudioTimeSyncController.StartSong()");
#endif
            HUDManager.findHUD();
            HUDManager.FindHUDElements();
            HUDManager.PutThings(CustomTypes.whereHUD.HMD);
            //HUDManager.FindLivCamera();
            //HUDManager.HideInLiv();
        }
Пример #11
0
        static void Postfix(AudioTimeSyncController __instance)
        {
            if (AutoPauseStealthController.StabilityPeriodActive && !AutoPauseStealthController.IsMultiplayer)
            {
                AutoPauseStealthController.ScoreController.enabled = false;
                AutoPauseStealthController.SongController.PauseSong();
                Logger.log?.Debug($"AutoPauseStealthController.StabilityPeriodActive is true " +
                                  $"=> Pausing game right after AudioTimeSyncControllerPatch::StartSong()");
            }

            return;
        }
        internal void Construct(SiraLog siraLog, PluginConfig config, ScvAssetLoader assetLoader, AudioTimeSyncController audioTimeSyncController,
                                IReadonlyBeatmapData beatmap, TimeTweeningManager timeTweeningManager)
        {
            _timeTweeningManager = timeTweeningManager;
            _assetLoader         = assetLoader;
            _siraLog             = siraLog;
            _config = config;
            _audioTimeSyncController = audioTimeSyncController;
            _beatmapData             = beatmap;

            name = $"{nameof(SongChartVisualizer)} View";
        }
Пример #13
0
 private void LevelLoaded()
 {
     callbackController = GameObject.Find("Vertical Grid Callback").GetComponent <BeatmapObjectCallbackController>();
     rotationCallback   = Resources.FindObjectsOfTypeAll <RotationCallbackController>().First();
     atsc = rotationCallback.atsc;
     if (RotationController != null)
     {
         RotationController.RotationCallback = rotationCallback;
         RotationController.Init();
     }
     callbackController.EventPassedThreshold += EventPassed;
     RefreshLightingManagers();
 }
        public void Awake()
        {
            beatmapObjectCallbackController = GetComponent <BeatmapObjectCallbackController>();
            var initData = beatmapObjectCallbackController.GetField <BeatmapObjectCallbackController.InitData, BeatmapObjectCallbackController>("_initData");

            audioTimeSyncController = beatmapObjectCallbackController.GetField <IAudioTimeSource, BeatmapObjectCallbackController>("_audioTimeSource") as AudioTimeSyncController;
            spawningStartTime       = initData.spawningStartTime;
            songTime                 = audioTimeSyncController.songTime;
            songDeltaTime            = audioTimeSyncController.songTime; // first delta is the point the song starts at, not 0
            eventLoopbackCallbackIds = new Dictionary <string, int>();
            SetNewBeatmapData(initData.beatmapData);
            Plugin.invokeCallbackControllerAwake(this);
        }
Пример #15
0
        private IEnumerator DisplayLyrics(IList <Subtitle> subtitles)
        {
            AudioTimeSyncController audio = (AudioTimeSyncController)AudioTimeSyncField.GetValue(songController);

            // Since subtitles are sorted by time of appearance, we save in the index variable
            // the next subtitle to display (initially the first one at index 0), and when
            // said subtitle is supposed to appear, we spawn it using SpawnText, until either
            // the end of the song if it's the last subtitle, or the next subtitle otherwise.
            for (int i = 0; i < subtitles.Count;)
            {
                Subtitle subtitle = subtitles[i];

                float subtitleTime = subtitle.Time,
                      currentTime  = audio.songTime;

                if (subtitleTime > currentTime)
                {
                    // Not there yet, wait for next subtitle.
                    if (subtitleTime - currentTime > 1f)
                    {
                        yield return(new WaitForSeconds(subtitleTime - currentTime));
                    }
                    else
                    {
                        yield return(new WaitForEndOfFrame());
                    }

                    continue;
                }

                // We good, display subtitle and increase current index.
                float displayDuration;

                if (subtitle.EndTime.HasValue)
                {
                    displayDuration = subtitle.EndTime.Value - currentTime;
                    i++;
                }
                else
                {
                    displayDuration = ++i == subtitles.Count
                                    ? audio.songLength - currentTime
                                    : subtitles[i].Time - currentTime;
                }

                if (Settings.DisplayLyrics)
                {
                    SpawnText(subtitle.Text, displayDuration);
                }
            }
        }
Пример #16
0
        public void Init(OnlinePlayerController newOwner, OnlineBeatmapCallbackController callbackController, OnlineAudioTimeController syncController)
        {
            BeatmapObjectSpawnController original = FindObjectsOfType <BeatmapObjectSpawnController>().First(x => !x.name.StartsWith("Online"));

            foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Default).Where(x => !x.Name.ToLower().Contains("event")))
            {
                info.SetValue(this, info.GetValue(original));
            }

            owner = newOwner;

            try
            {
                if (BS_Utils.Plugin.LevelData.IsSet)
                {
                    LevelOptionsInfo   levelInfo   = owner.PlayerInfo.playerLevelOptions;
                    IDifficultyBeatmap diffBeatmap = BS_Utils.Plugin.LevelData.GameplayCoreSceneSetupData.difficultyBeatmap.level.beatmapLevelData.difficultyBeatmapSets.First(x => x.beatmapCharacteristic.serializedName == owner.PlayerInfo.playerLevelOptions.characteristicName).difficultyBeatmaps.First(x => x.difficulty == owner.PlayerInfo.playerLevelOptions.difficulty);

                    Init(diffBeatmap.level.beatsPerMinute, diffBeatmap.beatmapData.beatmapLinesData.Length, diffBeatmap.noteJumpMovementSpeed, diffBeatmap.noteJumpStartBeatOffset, levelInfo.modifiers.disappearingArrows, levelInfo.modifiers.ghostNotes);
                }
            }catch (Exception e)
            {
                Plugin.log.Warn("Unable to update beatmap data! Exception: " + e);
            }

            onlineCallbackController         = callbackController;
            _beatmapObjectCallbackController = onlineCallbackController;
            onlineSyncController             = syncController;

            if (onlineCallbackController != null)
            {
                _beatmapObjectCallbackId = onlineCallbackController.AddBeatmapObjectCallback(new BeatmapObjectCallbackController.BeatmapObjectCallback(BeatmapObjectSpawnCallback), _spawnAheadTime);
            }

            _localPlayer         = FindObjectsOfType <PlayerController>().First(x => !(x is OnlinePlayerController));
            _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !(x is OnlineAudioTimeController));

            NoteCutEffectSpawner cutEffectSpawner = FindObjectOfType <NoteCutEffectSpawner>();

            (this as BeatmapObjectSpawnController).noteWasCutEvent += (sender, controller, cutInfo) => { if (cutInfo.allIsOK)
                                                                                                         {
                                                                                                             cutEffectSpawner.HandleNoteWasCutEvent(sender, controller, cutInfo);
                                                                                                         }
            };

            _activeNotes     = new List <NoteController>();
            _activeObstacles = new List <ObstacleController>();
        }
Пример #17
0
        public IEnumerator WaitForComponentCreation()
        {
            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <ScoreController>().Any()));

            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().Any()));

            _scoreController         = Resources.FindObjectsOfTypeAll <ScoreController>().First();
            _audioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().First();

            var match = Resources.FindObjectsOfTypeAll <RoomCoordinator>().FirstOrDefault()?.Match;

            destinationPlayers = Plugin.client.State.ServerSettings.TournamentMode ?
                                 new Guid[] { match.Leader.Id } :
            match.Players.Select(x => x.Id).Union(new Guid[] { match.Leader.Id }).ToArray();     //We don't wanna be doing this every frame
            //new string[] { "x_x" }; //Note to future moon, this will cause the server to recieve the forwarding packet and forward it to no one. Since it's recieved, though, the scoreboard will get it if connected
        }
Пример #18
0
        public void Init(OnlinePlayerController newOwner, OnlineAudioTimeController syncController)
        {
            BeatmapObjectManager original = FindObjectsOfType <BeatmapObjectManager>().First(x => !(x is OnlineBeatmapObjectManager));

            transform.position = original.transform.position;

            foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).Where(x => !x.Name.ToLower().Contains("event")))
            {
                info.SetValue(this, info.GetValue(original));
            }

            owner = newOwner;
            onlineSyncController = syncController;

            _localPlayer         = FindObjectsOfType <PlayerController>().First(x => !(x is OnlinePlayerController));
            _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !(x is OnlineAudioTimeController));
        }
Пример #19
0
        public void Construct(PluginConfig config,
                              Submission submission,
                              AudioTimeSyncController audioTimeSyncController,
                              BeatmapLevelsModel beatmapLevelsModel,
                              GameplayCoreSceneSetupData gameplayCoreSceneSetupData,
                              GameSongController gameSongController)
        {
            _config     = config;
            _submission = submission;
            _audioTimeSyncController    = audioTimeSyncController;
            _beatmapLevelsModel         = beatmapLevelsModel;
            _gameplayCoreSceneSetupData = gameplayCoreSceneSetupData;
            _gameSongController         = gameSongController;
            _random = new System.Random();
            IBeatmapLevelPack beatmapLevelPack = _beatmapLevelsModel.GetLevelPackForLevelId(_gameplayCoreSceneSetupData.difficultyBeatmap.level.levelID);

            _previewBeatmapLevels = beatmapLevelPack.beatmapLevelCollection.beatmapLevels;
        }
Пример #20
0
 public void UpdateSongOffset()
 {
     if (!timeSync)
     {
         timeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().First();
     }
     else
     {
         if ((timeSync.songLength - timeSync.songTime) > 30)
         {
             SteamAPI.SetSongOffset(timeSync.songTime);
         }
         else
         {
             SteamAPI.SetSongOffset(0f);
             CancelInvoke("UpdateSongOffset");
         }
     }
 }
Пример #21
0
        public IEnumerator WaitForComponentCreation()
        {
            var coordinator = Resources.FindObjectsOfTypeAll <RoomCoordinator>().FirstOrDefault();
            var match       = coordinator?.Match;

            var id = match.LeaderCase == Match.LeaderOneofCase.Coordinator ? match.Coordinator?.Id : match.Player?.Id;

            destinationPlayers = ((bool)(coordinator?.TournamentMode) && !Plugin.UseFloatingScoreboard) ?
                                 new Guid[] { Guid.Parse(id) } :
            match.Players.Select(x => Guid.Parse(x.Id)).Union(new Guid[] { Guid.Parse(id) }).ToArray();     //We don't wanna be doing this every frame
                                                                                                            //new string[] { "x_x" }; //Note to future moon, this will cause the server to receive the forwarding packet and forward it to no one. Since it's received, though, the scoreboard will get it if connected

            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <ScoreController>().Any()));

            yield return(new WaitUntil(() => Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().Any()));

            _scoreController         = Resources.FindObjectsOfTypeAll <ScoreController>().First();
            _audioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().First();
        }
Пример #22
0
        [Inject] internal void ModifierInit([InjectOptional] StandardGameplaySceneSetupData sgssd, SongProgressUIController spuic, AudioTimeSyncController atsc, Config.Progress c)
        {
            Logger.Logger.Debug("SongProgressPanelModifier:ModifierInit()");
            Controller     = spuic;
            SyncController = atsc;
            Config         = c;
            BarComponents  = new();

            transform.SetParent(spuic.transform);

            if (sgssd?.beatmapCharacteristic.containsRotationEvents == true)
            {
                Logger.Logger.Debug("Selected map is 360/90. Disabling the SongProgressPanelModifier");
                canBeUsed = false;
                return;
            }

            ModPanel();
        }
Пример #23
0
        public virtual bool Init(CameraPlusBehaviour cameraPlus, bool useSongSpecificScript)
        {
            if (_audioTimeSyncController == null)
            {
                _audioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
            }

            _cameraPlus = cameraPlus;
            Plugin.Instance.ActiveSceneChanged += OnActiveSceneChanged;

            if (useSongSpecificScript && File.Exists(Path.Combine(CustomPreviewBeatmapLevelPatch.customLevelPath, "SongScript.json")))
            {
                Logger.Log($"{Path.Combine(CustomPreviewBeatmapLevelPatch.customLevelPath, "SongScript.json")}", LogLevel.Notice);
                return(LoadCameraData(Path.Combine(CustomPreviewBeatmapLevelPatch.customLevelPath, "SongScript.json")));
            }
            else
            {
                return(LoadCameraData(cameraPlus.Config.movementScriptPath));
            }
        }
Пример #24
0
        public static void SongStarted(AudioTimeSyncController controller)
        {
            audioTimeSyncController = controller;
            ScoresaberUtil.UpdateIsInReplay();

            TransparentWalls.MakeWallsOpaqueForMainCam();
            CamManager.ApplyCameraValues(worldCam: true);

            if (CamManager.cams.Values.Any(x => !x.settings.visibleObjects.Floor))
            {
                // Move the plattform stuff to the correct layer because beat games didnt
                foreach (var x in (new string[] { "Construction", "Frame", "RectangleFakeGlow" }).Select(x => GameObject.Find($"Environment/PlayersPlace/{x}")))
                {
                    if (x != null)
                    {
                        x.layer = (int)VisibilityLayers.PlayerPlattform;
                    }
                }
            }
        }
Пример #25
0
        IEnumerator WaitForLoad()
        {
            bool loaded = false;

            while (!loaded)
            {
                _audioTimeSync = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();

                if (_audioTimeSync == null)
                {
                    yield return(new WaitForSeconds(0.01f));
                }
                else
                {
                    loaded = true;
                }
            }

            Init();
        }
Пример #26
0
    // We use the unity api on the main thread to pull data to be processed in the background
    public void Begin(bool is3d, Gradient spectrogramHeightGradient, AudioClip audioClip, WaveformData waveformData, AudioTimeSyncController atsc, int chunkSize)
    {
        this.spectrogramHeightGradient = spectrogramHeightGradient;
        this.is3d         = is3d;
        this.waveformData = waveformData;
        this.atsc         = atsc;
        this.chunkSize    = chunkSize;

        numChannels     = audioClip.channels;
        numTotalSamples = audioClip.samples;
        clipLength      = audioClip.length;
        sampleRate      = audioClip.frequency;

        multiChannelSamples = new float[numTotalSamples * numChannels];
        audioClip.GetData(multiChannelSamples, 0);

        waveformData.Chunks = (int)Math.Ceiling(clipLength / secondPerChunk);

        // How many audio samples wide a column is, we will likely use more samples
        // than the width to perform the FFT which has a smoothing effect
        if (is3d)
        {
            sampleOffset = secondPerChunk / ColumnsPerChunk * sampleRate;
            waveformData.InitBandVolumes(ColumnsPerChunk, _bands.Length - 1);
        }
        else
        {
            int   samples         = (int)GetSampleCount() / 2;
            float samplesPerChunk = sampleRate * secondPerChunk;
            ColumnsPerChunk = (int)samplesPerChunk / samples;
            sampleOffset    = samplesPerChunk / ColumnsPerChunk;
            waveformData.InitBandVolumes(ColumnsPerChunk, samples + 1);
        }

        Debug.Log("WaveformGenerator: Starting Background Thread");

        Thread bgThread = new Thread(PreProcessData);

        backgroundThreads.Add(bgThread);
        bgThread.Start();
    }
Пример #27
0
        private void Start()
        {
            Random.InitState((int)DateTime.Now.Ticks);
            _audioTimeSyncController = Resources.FindObjectsOfTypeAll <AudioTimeSyncController>().FirstOrDefault();
            _mainGameSceneSetupData  = BS_Utils.Plugin.LevelData;
            _beatmapData             = _mainGameSceneSetupData?.GameplayCoreSceneSetupData?.difficultyBeatmap?.beatmapData;
            _monsterSpawnInfos       = new List <MonsterSpawnInfo>();

            if (_beatmapData != null)
            {
                Logger.log.Debug("There are " + _beatmapData.notesCount + " notes");
                Logger.log.Debug("There are " + _beatmapData.beatmapLinesData.Length + " lines");
                var songDuration = _mainGameSceneSetupData?.GameplayCoreSceneSetupData?.difficultyBeatmap?.level?.beatmapLevelData?.audioClip?.length ?? -1f;
                if (songDuration >= 0)
                {
                    var notePeriods = GetNotesInPeriods(Mathf.CeilToInt(songDuration / 60));
                    foreach (var notePeriod in notePeriods)
                    {
                        var noteCountDuration = (uint)Random.Range((int)(notePeriod.Count * 0.15f), (int)(notePeriod.Count * 0.3f));
                        var noteIndex         = Random.Range(0, notePeriod.Count - (int)noteCountDuration);
                        var monsterDifficulty = (uint)Random.Range(1, 12);
                        var monsterSpawnInfo  = new MonsterSpawnInfo("Uber Cthulhu", ((int)(ScoreController.kMaxCutRawScore / 2f) + monsterDifficulty * 4) * noteCountDuration,
                                                                     notePeriod[noteIndex].time - 0.25f, notePeriod[noteIndex + (int)noteCountDuration].time,
                                                                     noteCountDuration, monsterDifficulty,
                                                                     new[] { _modifierTypes[Random.Range(0, _modifierTypes.Length)] });
                        _monsterSpawnInfos.Add(monsterSpawnInfo);
                        Logger.log.Debug(monsterSpawnInfo.monsterName + " lv." + monsterSpawnInfo.monsterDifficulty +
                                         " with " + monsterSpawnInfo.monsterHp + " HP will spawn at: " + monsterSpawnInfo.spawnTime +
                                         " | and will finish at: " + monsterSpawnInfo.unspawnTime);
                        Logger.log.Debug("Modifiers applied: ");
                        foreach (var modifierType in monsterSpawnInfo.modifierTypes)
                        {
                            Logger.log.Debug($"-> {modifierType}");
                        }
                        Logger.log.Debug("-----------------");
                    }
                }
            }

            InvokeRepeating("CheckForCreateMonster", 0, 0.25f);
        }
Пример #28
0
 void DismissGraph(ResultsViewController vc)
 {
     if (panel != null)
     {
         panel.SetActive(false);
         Destroy(panel, 1);
         panel           = null;
         scoreController = null;
         objectManager   = null;
         comboController = null;
         energyCounter   = null;
         rankCounter     = null;
         audioController = null;
         endActions      = null;
     }
     if (vc != null)
     {
         vc.continueButtonPressedEvent -= DismissGraph;
         vc.restartButtonPressedEvent  -= DismissGraph;
     }
 }
Пример #29
0
        private GlobalTrickManager(
            SiraLog logger,
            PluginConfig config,
            AudioTimeSyncController audioTimeSyncController,
            GameplayCoreSceneSetupData gameplayCoreSceneSetup,
            [Inject(Id = SaberType.SaberA)] SaberTrickManager leftTrickManager,
            [Inject(Id = SaberType.SaberB)] SaberTrickManager rightTrickManager,
            [InjectOptional] MultiplayerPlayersManager multiplayerPlayersManager)
        {
            _logger = logger;
            _config = config;
            _audioTimeSyncController = audioTimeSyncController;

            _iDifficultyBeatmap = gameplayCoreSceneSetup.difficultyBeatmap;

            _slowmoStepAmount = _config.SlowmoStepAmount;

            LeftSaberTrickManager  = leftTrickManager;
            RightSaberTrickManager = rightTrickManager;

            _isMultiplayer = multiplayerPlayersManager != null;
        }
Пример #30
0
        public void Init(OnlinePlayerController newOwner, OnlineBeatmapCallbackController callbackController, OnlineAudioTimeController syncController)
        {
            BeatmapObjectSpawnController original = FindObjectsOfType <BeatmapObjectSpawnController>().First(x => !(x is OnlineBeatmapSpawnController));

            foreach (FieldInfo info in original.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance | BindingFlags.NonPublic).Where(x => !x.Name.ToLower().Contains("event")))
            {
                info.SetValue(this, info.GetValue(original));
            }

            _beatmapCallbackItemDataList = new List <BeatmapObjectSpawnController.BeatmapCallbackItemData>(10);

            owner = newOwner;

            _beatmapObjectCallbackController = callbackController;
            onlineSyncController             = syncController;

            _localPlayer         = FindObjectsOfType <PlayerController>().First(x => !(x is OnlinePlayerController));
            _localSyncController = FindObjectsOfType <AudioTimeSyncController>().First(x => !(x is OnlineAudioTimeController));

            _activeNotes     = new List <NoteController>();
            _activeObstacles = new List <ObstacleController>();
        }