public void ResetToDefault() { m_inverted = false; m_rimLight = RimType.None; Refresh(); }
public RimData(GameObject parent, Material material, Renderer[] renderers, RimType rimType, Color color, float power = DEFAULT_POWER, float intensity = DEFAULT_INTENSITY) { this.parent = parent; this.material = GameObject.Instantiate(material); this.m_lastRimType = rimType; this.renderers = renderers; this.rimType = rimType; this.color = color; this.power = power; this.intensity = intensity; UpdateMaterial(); }
private void UpdateMaterial() { if (material == null || m_lastRimType != rimType) { m_lastRimType = rimType; if (material == null) { material = new Material(RimManager.Instance.GetShader(m_lastRimType)); } else { material.shader = RimManager.Instance.GetShader(m_lastRimType); } m_lastColor = color; material.SetColor(RimManager.Instance.RIM_COLOR_ID, m_lastColor); m_lastPower = power; material.SetFloat(RimManager.Instance.RIM_POWER_ID, m_lastPower); m_lastIntensity = intensity; material.SetFloat(RimManager.Instance.RIM_INTENSITY_ID, m_lastIntensity); } else { if (m_lastColor != color) { m_lastColor = color; material.SetColor(RimManager.Instance.RIM_COLOR_ID, m_lastColor); } if (m_lastPower != power) { m_lastPower = power; material.SetFloat(RimManager.Instance.RIM_POWER_ID, m_lastPower); } if (m_lastIntensity != intensity) { m_lastIntensity = intensity; material.SetFloat(RimManager.Instance.RIM_INTENSITY_ID, m_lastIntensity); } } }
public RimData(GameObject parent, RimType rimType, Color color, float power = DEFAULT_POWER, float intensity = DEFAULT_INTENSITY) { this.parent = parent; List <Renderer> cacheRenderers = new List <Renderer>(); cacheRenderers.AddRange(parent.GetComponentsInChildren <SkinnedMeshRenderer>()); cacheRenderers.AddRange(parent.GetComponentsInChildren <MeshRenderer>()); cacheRenderers.AddRange(parent.GetComponentsInChildren <SpriteRenderer>()); renderers = cacheRenderers.ToArray(); this.rimType = rimType; this.color = color; this.power = power; this.intensity = intensity; UpdateMaterial(); }
public void UpdateRimLight(RimType type) { m_rimLight = type; UpdateShaders(); }
public Shader GetShader(RimType rimType) { return(m_shaders[rimType]); }
public void SetRimType(RimType rimType) { this.rimType = rimType; UpdateMaterial(); }