public InstaFailAccuracyGameController(PluginConfig config, ILevelEndActions levelEndActions, ScoreController scoreController, StandardLevelFailedController standardLevelFailedController) { _config = config; _levelEndActions = levelEndActions; _scoreController = scoreController; _standardLevelFailedController = standardLevelFailedController; }
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"); }
private void OnGameSceneLoaded() { //Logger.log.Debug("Game scene loaded!"); //Logger.log.Debug($"Does InstaFailAccuracy is enabled?: {InstaFailAccuracyGameplaySetup.instance.EnableInstaFailAcc}"); //Logger.log.Debug($"Current threshold: {InstaFailAccuracyGameplaySetup.instance.FailThresholdValue}"); if (InstaFailAccuracyGameplaySetup.instance.EnableInstaFailAcc) { _alreadyFailed = false; _rankCounter = Resources.FindObjectsOfTypeAll <RelativeScoreAndImmediateRankCounter>().First(); _standardLevelFailedController = Resources.FindObjectsOfTypeAll <StandardLevelFailedController>().First(); _rankCounter.relativeScoreOrImmediateRankDidChangeEvent += OnRelativeScoreOrImmediateRankDidChangeEvent; } CurrentGameStatus = GameStatus.Game; }
public void Awake() { _standardLevelGameplayManager = Resources.FindObjectsOfTypeAll <StandardLevelGameplayManager>().FirstOrDefault(); // Use the appropriate level failed event if (_standardLevelGameplayManager) { _standardLevelGameplayManager.levelFailedEvent += this.OnLevelFail; _standardLevel = true; } else { _missionLevelGameplayManager = Resources.FindObjectsOfTypeAll <MissionLevelGameplayManager>().FirstOrDefault(); _missionLevelGameplayManager.levelFailedEvent += this.OnLevelFail; _standardLevel = false; } // Get all the necessary fields _standardLevelFailedController = Resources.FindObjectsOfTypeAll <StandardLevelFailedController>().FirstOrDefault(); if (_standardLevelFailedController) { _standardLevelSceneSetupData = _standardLevelFailedController.GetField <StandardLevelScenesTransitionSetupDataSO, StandardLevelFailedController>("_standardLevelSceneSetupData"); _standardInitData = _standardLevelFailedController.GetField <StandardLevelFailedController.InitData, StandardLevelFailedController>("_initData"); _prepareLevelCompletionResults = _standardLevelFailedController.GetField <PrepareLevelCompletionResults, StandardLevelFailedController>("_prepareLevelCompletionResults"); } else { _missionLevelFailedController = Resources.FindObjectsOfTypeAll <MissionLevelFailedController>().FirstOrDefault(); _missionLevelSceneSetupData = _missionLevelFailedController.GetField <MissionLevelScenesTransitionSetupDataSO, MissionLevelFailedController>("_missionLevelSceneSetupData"); _missionInitData = _missionLevelFailedController.GetField <MissionLevelFailedController.InitData, MissionLevelFailedController>("_initData"); _missionObjectiveCheckersManager = _missionLevelFailedController.GetField <MissionObjectiveCheckersManager, MissionLevelFailedController>("_missionObjectiveCheckersManager"); _prepareLevelCompletionResults = _missionLevelFailedController.GetField <PrepareLevelCompletionResults, MissionLevelFailedController>("_prepareLevelCompletionResults"); } _vrControllersInputManager = Resources.FindObjectsOfTypeAll <PauseMenuManager>().FirstOrDefault() .GetField <VRControllersInputManager, PauseMenuManager>("_vrControllersInputManager"); }
private void GetObjects() { if (_spawnController == null) { _spawnController = Resources.FindObjectsOfTypeAll <BeatmapObjectSpawnController>().FirstOrDefault(); } if (_spawnController == null) { return; } _spawnController.noteWasCutEvent -= _spawnController_noteWasCutEvent; _spawnController.noteWasMissedEvent -= _spawnController_noteWasMissedEvent; if (LevelData == null) { LevelData = BS_Utils.Plugin.LevelData; } if (LevelData == null) { return; } if (_levelFailedController == null) { _levelFailedController = Resources.FindObjectsOfTypeAll <StandardLevelFailedController>().FirstOrDefault(); } if (_levelRestartController == null) { _levelRestartController = Resources.FindObjectsOfTypeAll <StandardLevelRestartController>().FirstOrDefault(); } if (_energyCounter == null) { _energyCounter = Resources.FindObjectsOfTypeAll <GameEnergyCounter>().FirstOrDefault(); } if (_scoreController == null) { _scoreController = Resources.FindObjectsOfTypeAll <ScoreController>().FirstOrDefault(); } if (!CheckRestrictions()) { return; } _spawnController.noteWasCutEvent += _spawnController_noteWasCutEvent; _spawnController.noteWasMissedEvent += _spawnController_noteWasMissedEvent; _energyCounter.gameEnergyDidReach0Event += _energyCounter_gameEnergyDidReach0Event; if (Config.failOnSaberClash) { LevelData.GameplayCoreSceneSetupData.gameplayModifiers.failOnSaberClash = true; } if (Config.stricterAngles) { Log("Disabling Score Submission for Stricter Angles"); BS_Utils.Gameplay.ScoreSubmission.DisableSubmission("Gameplay Restrictions Plus"); LevelData.GameplayCoreSceneSetupData.gameplayModifiers.strictAngles = true; } }