30 lines
942 B
C#
30 lines
942 B
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.VFX.Utility;
|
|
using UnityEngine.VFX;
|
|
using UnityEngine;
|
|
|
|
[AddComponentMenu("VFX/Property Binders/Kaiju - Theme Binder")]
|
|
[VFXBinder("Kaiju/Kaiju Theme Binder")]
|
|
public class ThemeVfxBinder : VFXBinderBase {
|
|
public ThemeSelector themeSelector;
|
|
|
|
[VFXPropertyBinding("UnityEngine.Gradient"), SerializeField]
|
|
protected ExposedProperty ThemeParameter = "Theme";
|
|
|
|
void Awake() {
|
|
if (themeSelector == null) Debug.Log("Theme VFX Binder needs theme selector.");
|
|
}
|
|
|
|
public override bool IsValid(VisualEffect component) {
|
|
return themeSelector != null
|
|
&& themeSelector.CurrentTheme() != null
|
|
&& component.HasGradient(ThemeParameter);
|
|
}
|
|
|
|
public override void UpdateBinding(VisualEffect component) {
|
|
component.SetGradient(ThemeParameter, themeSelector.CurrentTheme());
|
|
}
|
|
}
|