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(); } }
protected override void Refresh() { Color color = Color; if (color == _obstacleFrame.color) { return; } _obstacleFrame.color = color; _obstacleFrame.Refresh(); if (_obstacleFakeGlow != null) { _obstacleFakeGlow.color = color; _obstacleFakeGlow.Refresh(); } Color value = color * _addColorMultiplier; value.a = 0f; foreach (MaterialPropertyBlockController materialPropertyBlockController in _materialPropertyBlockControllers) { materialPropertyBlockController.materialPropertyBlock.SetColor(_addColorID, value); materialPropertyBlockController.materialPropertyBlock.SetColor(_tintColorID, Color.Lerp(color, Color.white, _obstacleCoreLerpToWhiteFactor)); materialPropertyBlockController.ApplyChanges(); } }