public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { if (Host == null) { return(new InteractableThemePropertyValue()); } InteractableThemePropertyValue start = new InteractableThemePropertyValue(); string propId = property.GetShaderPropId(); switch (property.Type) { case InteractableThemePropertyValueTypes.Color: start.Color = propertyBlock.GetVector(propId); break; case InteractableThemePropertyValueTypes.ShaderFloat: start.Float = propertyBlock.GetFloat(propId); break; case InteractableThemePropertyValueTypes.shaderRange: start.Float = propertyBlock.GetFloat(propId); break; default: break; } return(start); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { if (Host == null) { return; } string propId = property.GetShaderPropId(); float newValue; switch (property.Type) { case InteractableThemePropertyValueTypes.Color: Color newColor = Color.Lerp(property.StartValue.Color, property.Values[index].Color, percentage); propertyBlock = SetColor(propertyBlock, newColor, propId); break; case InteractableThemePropertyValueTypes.ShaderFloat: newValue = LerpFloat(property.StartValue.Float, property.Values[index].Float, percentage); propertyBlock = SetFloat(propertyBlock, newValue, propId); break; case InteractableThemePropertyValueTypes.shaderRange: newValue = LerpFloat(property.StartValue.Float, property.Values[index].Float, percentage); propertyBlock = SetFloat(propertyBlock, newValue, propId); break; default: break; } SetPropertyBlock(Host, propertyBlock); }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.Vector3 = Host.transform.localPosition; return(start); }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.Vector3 = Host.transform.eulerAngles; return(start); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { Host.SetActive(property.Values[index].Bool); material = property.Values[index].Material; renderer.material = material; }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.Vector3 = hostTransform.localScale; return(start); }
public override void Init(GameObject host, InteractableThemePropertySettings settings) { base.Init(host, settings); shaderProperties = new List <ShaderProperties>(); for (int i = 0; i < ThemeProperties.Count; i++) { InteractableThemeProperty prop = ThemeProperties[i]; if (prop.ShaderOptions.Count > 0) { shaderProperties.Add(prop.ShaderOptions[prop.PropId]); } } propertyBlocks = new List <BlocksAndRenderer>(); Renderer[] list = host.GetComponentsInChildren <Renderer>(); for (int i = 0; i < list.Length; i++) { MaterialPropertyBlock block = InteractableThemeShaderUtils.GetMaterialPropertyBlock(list[i].gameObject, shaderProperties.ToArray()); BlocksAndRenderer bAndR = new BlocksAndRenderer(); bAndR.Renderer = list[i]; bAndR.Block = block; propertyBlocks.Add(bAndR); } }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.Bool = Host.activeSelf; return(start); }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.Texture = propertyBlock.GetTexture("_MainTex"); return(start); }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.String = property.Values[lastIndex].String; return(start); }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); material = renderer.material; start.Material = material; return(start); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { propertyBlock.SetTexture("_MainTex", property.Values[index].Texture); Renderer renderer = Host.GetComponent <Renderer>(); renderer.SetPropertyBlock(propertyBlock); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { if (audioSource == null) { audioSource = Host.AddComponent <AudioSource>(); } audioSource.clip = property.Values[index].AudioClip; audioSource.Play(); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { if (lastIndex != index) { if (controller != null) { controller.SetTrigger(property.Values[index].String); } lastIndex = index; } }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); AudioSource audioSource = Host.GetComponentInChildren <AudioSource>(); if (audioSource != null) { start.AudioClip = audioSource.clip; } return(start); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { if (mesh != null) { mesh.text = property.Values[index].String; return; } if (mesh != null) { text.text = property.Values[index].String; } }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { Color color = Color.Lerp(property.StartValue.Color, property.Values[index].Color, percentage); string propId = property.GetShaderPropId(); for (int i = 0; i < propertyBlocks.Count; i++) { BlocksAndRenderer bAndR = propertyBlocks[i]; bAndR.Block.SetColor(propId, color); bAndR.Renderer.SetPropertyBlock(bAndR.Block); propertyBlocks[i] = bAndR; } }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue color = new InteractableThemePropertyValue(); string propId = property.GetShaderPropId(); if (propertyBlocks.Count > 0) { BlocksAndRenderer bAndR = propertyBlocks[0]; color.Color = bAndR.Block.GetVector(propId); } return(color); }
public override void Init(GameObject host, InteractableThemePropertySettings settings) { base.Init(host, settings); shaderProperties = new List <ShaderProperties>(); for (int i = 0; i < ThemeProperties.Count; i++) { InteractableThemeProperty prop = ThemeProperties[i]; if (prop.ShaderOptions.Count > 0) { shaderProperties.Add(prop.ShaderOptions[prop.PropId]); } } propertyBlock = InteractableThemeShaderUtils.GetMaterialPropertyBlock(host, shaderProperties.ToArray()); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { TextMesh mesh = Host.GetComponentInChildren <TextMesh>(); if (mesh != null) { mesh.text = property.Values[index].String; return; } Text text = Host.GetComponentInChildren <Text>(); if (mesh != null) { text.text = property.Values[index].String; } }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue color = new InteractableThemePropertyValue(); if (mesh != null) { color.Color = mesh.color; return(color); } if (text != null) { color.Color = text.color; return(color); } return(base.GetProperty(property)); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { Color color = Color.Lerp(property.StartValue.Color, property.Values[index].Color, percentage); if (mesh != null) { mesh.color = color; return; } if (text != null) { text.color = color; return; } base.SetValue(property, index, percentage); }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.String = ""; if (mesh != null) { start.String = mesh.text; return(start); } if (mesh != null) { start.String = text.text; } return(start); }
public override void SetValue(InteractableThemeProperty property, int index, float percentage) { switch (property.Name) { case "Scale": hostTransform.localScale = Vector3.Lerp(property.StartValue.Vector3, Vector3.Scale(startScale, property.Values[index].Vector3), percentage); break; case "Offset": hostTransform.localPosition = Vector3.Lerp(property.StartValue.Vector3, startPosition + property.Values[index].Vector3, percentage); break; case "Color": base.SetValue(property, index, percentage); break; default: break; } }
public virtual void OnUpdate(int state, bool force = false) { if (state != lastState || force) { int themePropCount = ThemeProperties.Count; for (int i = 0; i < themePropCount; i++) { InteractableThemeProperty current = ThemeProperties[i]; current.StartValue = GetProperty(current); if (hasFirstState || force) { Ease.Start(); SetValue(current, state, Ease.GetCurved()); hasFirstState = true; } else { SetValue(current, state, 1); if (i >= themePropCount - 1) { hasFirstState = true; } } ThemeProperties[i] = current; } lastState = state; } else if (Ease.Enabled && Ease.IsPlaying()) { Ease.OnUpdate(); int themePropCount = ThemeProperties.Count; for (int i = 0; i < themePropCount; i++) { InteractableThemeProperty current = ThemeProperties[i]; SetValue(current, state, Ease.GetCurved()); } } lastState = state; }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue color = new InteractableThemePropertyValue(); TextMesh mesh = Host.GetComponent <TextMesh>(); if (mesh != null) { color.Color = mesh.color; return(color); } Text text = Host.GetComponent <Text>(); if (text != null) { color.Color = text.color; return(color); } return(base.GetProperty(property)); }
public virtual void Init(GameObject host, InteractableThemePropertySettings settings) { Host = host; for (int i = 0; i < settings.Properties.Count; i++) { InteractableThemeProperty prop = ThemeProperties[i]; prop.ShaderOptionNames = settings.Properties[i].ShaderOptionNames; prop.ShaderOptions = settings.Properties[i].ShaderOptions; prop.PropId = settings.Properties[i].PropId; prop.Values = settings.Properties[i].Values; ThemeProperties[i] = prop; } Ease = CopyEase(settings.Easing); Ease.Stop(); Loaded = true; }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); start.String = ""; TextMesh mesh = Host.GetComponentInChildren <TextMesh>(); if (mesh != null) { start.String = mesh.text; return(start); } Text text = Host.GetComponentInChildren <Text>(); if (mesh != null) { start.String = text.text; } return(start); }
public override InteractableThemePropertyValue GetProperty(InteractableThemeProperty property) { InteractableThemePropertyValue start = new InteractableThemePropertyValue(); switch (property.Name) { case "Scale": start.Vector3 = hostTransform.localScale; break; case "Offset": start.Vector3 = hostTransform.localPosition; break; case "Color": start = base.GetProperty(property); break; default: break; } return(start); }
public abstract InteractableThemePropertyValue GetProperty(InteractableThemeProperty property);