// Using the magical power of Zenject™, we magically find ourselves with an instance of // our HUDConfigModel and the CoreGameHUDController. internal CanvasUtility(HUDConfigModel hudConfig, MainConfigModel mainConfig, [InjectOptional] GameplayCoreSceneSetupData data, [InjectOptional] CoreGameHUDController coreGameHUD, [InjectOptional] MultiplayerPositionHUDController multiplayerPositionHUD) { this.mainConfig = mainConfig; if (coreGameHUD != null) { var comboPos = coreGameHUD.GetComponentInChildren <ComboUIController>().transform.position; hudWidth = Mathf.Abs(comboPos.x); hudHeight = comboPos.y; hudDepth = comboPos.z; energyCanvas = EnergyPanelGO(ref coreGameHUD).GetComponent <Canvas>(); // Hide base game elements if needed if (mainConfig.HideCombo) { HideBaseGameHUDElement <ComboUIController>(coreGameHUD); } if (mainConfig.HideMultiplier) { HideBaseGameHUDElement <ScoreMultiplierUIController>(coreGameHUD); } if (mainConfig.HideMultiplayerRank && multiplayerPositionHUD != null) { multiplayerPositionHUD.gameObject.SetActive(false); } } RefreshAllCanvases(hudConfig, data, coreGameHUD); }
protected override void OnDestroy() { Controller = null !; Config = null !; }