internal void SetActiveColors() { Color finalColor = _color ?? _globalColor ?? _color_Original; ParametricBoxFrameController obstacleFrame = _obstacleFrameAccessor(ref _stretchableObstacle); if (finalColor == obstacleFrame.color) { return; } ParametricBoxFakeGlowController obstacleFakeGlow = _obstacleFakeGlowAccessor(ref _stretchableObstacle); MaterialPropertyBlockController[] materialPropertyBlockControllers = _materialPropertyBlockControllersAccessor(ref _stretchableObstacle); obstacleFrame.color = finalColor; obstacleFrame.Refresh(); obstacleFakeGlow.color = finalColor; obstacleFakeGlow.Refresh(); Color value = finalColor * _addColorMultiplierAccessor(ref _stretchableObstacle); value.a = 0f; float obstacleCoreLerpToWhiteFactor = _obstacleCoreLerpToWhiteFactorAccessor(ref _stretchableObstacle); foreach (MaterialPropertyBlockController materialPropertyBlockController in materialPropertyBlockControllers) { materialPropertyBlockController.materialPropertyBlock.SetColor(_addColorID, value); materialPropertyBlockController.materialPropertyBlock.SetColor(_tintColorID, Color.Lerp(finalColor, Color.white, obstacleCoreLerpToWhiteFactor)); materialPropertyBlockController.ApplyChanges(); } }
static void Postfix(Transform ____obstacleCore, ref ParametricBoxFakeGlowController ____obstacleFakeGlow) { Camera.main.cullingMask |= (1 << TransparentWallsPatch.WallLayerMask);//Enables HMD bits because layer 25 is masked by default if (____obstacleCore != null) { ____obstacleCore.gameObject.layer = WallLayerMask; if (____obstacleFakeGlow.enabled) ____obstacleCore.GetChild(0).gameObject.layer = WallLayerMask; } }
static void Postfix(Transform ____obstacleCore, ParametricBoxFakeGlowController ____obstacleFakeGlow, MaterialPropertyBlockController[] ____materialPropertyBlockControllers) { if (____obstacleCore != null) { // No-Bloom inner wall texture thingy if (____obstacleFakeGlow != null && ____obstacleFakeGlow.enabled == true) { ____obstacleFakeGlow.gameObject.layer = (int)VisibilityLayers.Walls; // This is PROBABLY not perfect, we'll have to see if this breaks at some point if (____materialPropertyBlockControllers.Length > 1) { ____materialPropertyBlockControllers[1].gameObject.layer = (int)VisibilityLayers.WallTextures; } } ____obstacleCore.gameObject.layer = (int)VisibilityLayers.WallTextures; } //____obstacleFakeGlow.enabled = false; }
internal ObstacleColorizer(ObstacleControllerBase obstacleController) { StretchableObstacle stretchableObstacle = obstacleController.GetComponent <StretchableObstacle>(); _obstacleFrame = _obstacleFrameAccessor(ref stretchableObstacle); _obstacleFakeGlow = _obstacleFakeGlowAccessor(ref stretchableObstacle); _addColorMultiplier = _addColorMultiplierAccessor(ref stretchableObstacle); _obstacleCoreLerpToWhiteFactor = _obstacleCoreLerpToWhiteFactorAccessor(ref stretchableObstacle); _materialPropertyBlockControllers = _materialPropertyBlockControllersAccessor(ref stretchableObstacle); if (obstacleController is ObstacleController trueObstacleController) { OriginalColor = _colorManagerAccessor(ref trueObstacleController).obstaclesColor; } else { // Fallback OriginalColor = Color.white; } Colorizers.Add(obstacleController, this); }
private void HandleObstacleDidStartMovementEvent(BeatmapObjectSpawnController obstacleSpawnController, ObstacleController obstacleController) { try { StretchableObstacle stretchableObstacle = ReflectionUtil.GetField <StretchableObstacle>(obstacleController, "_stretchableObstacle"); StretchableCube stretchableCore = ReflectionUtil.GetField <StretchableCube>(stretchableObstacle, "_stretchableCore"); ParametricBoxFrameController frameController = ReflectionUtil.GetField <ParametricBoxFrameController>(stretchableObstacle, "_obstacleFrame"); ParametricBoxFakeGlowController fakeGlowController = ReflectionUtil.GetField <ParametricBoxFakeGlowController>(stretchableObstacle, "_obstacleFakeGlow"); float time = obstacleController.obstacleData.time; Color color = ColourManager.GetBarrierColour(time); frameController.color = color; fakeGlowController.color = color; bool didRecolour = VFX.VFXRainbowBarriers.IsRainbowWalls(); ChromaHandleBarrierSpawnedEvent?.Invoke(ref stretchableObstacle, ref obstacleSpawnController, ref obstacleController, ref didRecolour); if (!didRecolour && color != ColourManager.DefaultBarrierColour && color != Color.clear) { RecolourWall(stretchableCore, ColourManager.GetCorrectedBarrierColour(time)); } } catch (Exception e) { ChromaLogger.Log(e); } }