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); }
public static void ColorizeObstacle(this ObstacleControllerBase obstactleController, Color?color) => obstactleController.GetObstacleColorizer().Colorize(color);
public static ObstacleColorizer GetObstacleColorizer(this ObstacleControllerBase obstactleController) => ObstacleColorizer.Colorizers[obstactleController];
private static void Postfix(ObstacleControllerBase ____obstacleController) { ObstacleColorizer.Colorizers.Remove(____obstacleController); }
private static void Prefix(ObstacleControllerBase ____obstacleController) { new ObstacleColorizer(____obstacleController); }