Class ColorableCollection
- Namespace
- Fallencake.UI
- Assembly
- Fallencake.UI.dll
Component for applying colors or gradients from collections to multiple UI assets with optional tinting.
public class ColorableCollection : UIBehaviour, IColorSetter, IColorAssetProvider, IGradientAssetProvider
- Inheritance
-
objectObjectComponentBehaviourMonoBehaviourUIBehaviourColorableCollection
- Implements
Properties
ColorAssetCollection
Lazily initialized color asset collection according to ColorizingType.
public IColorAssetCollection<Color> ColorAssetCollection { get; }
Property Value
- IColorAssetCollection<Color>
ColorAssetCollectionCount
Gets the number of available colors in the collection (excluding index 0 for UI purposes). Returns 0 if no collection is available or collection has only one item.
public int ColorAssetCollectionCount { get; }
Property Value
- int
ColorCollectionData
Gets the color collection data containing available colors.
public ColorCollectionData ColorCollectionData { get; }
Property Value
ColorableAssets
Gets the list of UI Graphics that will be affected by color changes.
public List<Graphic> ColorableAssets { get; }
Property Value
- List<Graphic>
ColorizingType
Gets the current colorizing type that determines component behavior.
public ColorizingType ColorizingType { get; }
Property Value
GradientAssetCollection
Lazily initialized gradient asset collection according to ColorizingType.
public IColorAssetCollection<Gradient> GradientAssetCollection { get; }
Property Value
- IColorAssetCollection<Gradient>
GradientAssetCollectionCount
Number of available gradients excluding index 0 when using collection data.
public int GradientAssetCollectionCount { get; }
Property Value
- int
GradientCollectionData
Gets the gradient collection data containing available gradients.
public GradientCollectionData GradientCollectionData { get; }
Property Value
Gradients
Gets the list of UI Gradients that will be affected by gradient changes.
public List<UIGradient> Gradients { get; }
Property Value
- List<UIGradient>
IsTintingEnabled
Gets or sets whether tinting is enabled.
public bool IsTintingEnabled { get; set; }
Property Value
- bool
SelectedColor
Gets or sets the currently selected color.
public Color SelectedColor { get; set; }
Property Value
- Color
SelectedColorIndex
Gets or sets the currently selected color index in the collection.
public int SelectedColorIndex { get; set; }
Property Value
- int
SelectedGradient
Gets or sets the currently selected gradient.
public Gradient SelectedGradient { get; set; }
Property Value
- Gradient
SelectedGradientIndex
Gets or sets the currently selected gradient index in the collection.
public int SelectedGradientIndex { get; set; }
Property Value
- int
TintColor
Gets or sets the tint color used for mixing with the selected color.
public Color TintColor { get; set; }
Property Value
- Color
TintCurve
Gets or sets the animation curve used to control the tinting across colorable assets.
public AnimationCurve TintCurve { get; set; }
Property Value
- AnimationCurve
TweenCoroutine
Gets or sets the current animation coroutine for color transitions.
public Coroutine TweenCoroutine { get; set; }
Property Value
- Coroutine
Methods
Awake()
Initializes the component and sets up asset collections. Called automatically by Unity.
protected override void Awake()
SelectColor(float)
Dynamically selects a color from the collection based on a float index value. The float value is rounded to the nearest integer index (e.g., 1.2 → 1, 1.55 → 2). Values outside the collection bounds are clamped to valid range.
public void SelectColor(float floatIndex)
Parameters
floatIndexfloatFloat index value that will be rounded and clamped to collection indices
SetColor(int)
Sets the color by index and updates the selected index and color/gradient values.
public void SetColor(int index)
Parameters
indexintThe index of the color/gradient to select
SetColor(int, float)
Sets the color by index with animation duration and updates the selected index and color/gradient values.
public void SetColor(int index, float duration)
Parameters
indexintThe index of the color/gradient to select
durationfloatAnimation duration in seconds
SetColor(Color)
Sets a specific color directly and updates the selected color value.
public void SetColor(Color color)
Parameters
colorColorThe color to set
SetColor(Color, float)
Sets a specific color with animation duration and updates the selected color value.
public void SetColor(Color color, float duration)
Parameters
colorColorThe color to set
durationfloatAnimation duration in seconds
SetColor(Gradient)
Sets a specific gradient directly and updates the selected gradient value.
public void SetColor(Gradient gradient)
Parameters
gradientGradientThe gradient to set
SetColor(Gradient, float)
Sets a specific gradient with animation duration and updates the selected gradient value.
public void SetColor(Gradient gradient, float duration)
Parameters
gradientGradientThe gradient to set
durationfloatAnimation duration in seconds
Start()
protected override void Start()