private static SpriteGlowMaterial CreateSharedFor(SpriteGlowEffect spriteGlow) { var material = new SpriteGlowMaterial(spriteGlow.Renderer.sprite.texture, spriteGlow.DrawOutside, spriteGlow.EnableInstancing); material.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.NotEditable; sharedMaterials.Add(material); return(material); }
public static SpriteGlowMaterial GetSharedFor(SpriteGlowEffect spriteGlow) { for (int i = 0; i < sharedMaterials.Count; i++) { if (IsSharedFor(sharedMaterials[i], spriteGlow)) { return(sharedMaterials[i]); } } return(CreateSharedFor(spriteGlow)); }
public IEnumerator ColorLerp(Color target, float time) { SpriteGlow.SpriteGlowEffect sr = GetComponent <SpriteGlow.SpriteGlowEffect>(); Color startColor = sr.GlowColor; float t = 0; while (t < time) { t += Time.deltaTime; sr.GlowColor = Lerp(startColor, target, t / time); yield return(null); } }
// Start is called before the first frame update void Start() { _renderer = GetComponent <SpriteRenderer>(); _animator = GetComponent <Animator>(); this.transform.position = Waypoints[_index].position; //_lightningParticle.SetActive(false); //_hitbox.SetActive(false); SetActiveState(false); _glow = this.GetComponent <SpriteGlow.SpriteGlowEffect>(); _glow.enabled = false; //_startScale = _sprite.localScale; }
public static Material GetSharedFor(SpriteGlowEffect spriteGlow) { var material = sharedMaterials.Find(m => m.SpriteTexture == spriteGlow.Renderer.sprite.texture && m.DrawOutside == spriteGlow.DrawOutside && m.InstancingEnabled == spriteGlow.EnableInstancing); if (!material) { material = new SpriteGlowMaterial(spriteGlow.Renderer.sprite.texture, spriteGlow.DrawOutside, spriteGlow.EnableInstancing); material.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.NotEditable; sharedMaterials.Add(material); } return(material); }
public static Material GetSharedFor (SpriteGlowEffect spriteGlow) { for (int i = 0; i < sharedMaterials.Count; i++) { if (sharedMaterials[i].SpriteTexture == spriteGlow.Renderer.sprite.texture && sharedMaterials[i].DrawOutside == spriteGlow.DrawOutside && sharedMaterials[i].InstancingEnabled == spriteGlow.EnableInstancing) return sharedMaterials[i]; } var material = new SpriteGlowMaterial(spriteGlow.Renderer.sprite.texture, spriteGlow.DrawOutside, spriteGlow.EnableInstancing); material.hideFlags = HideFlags.DontSaveInBuild | HideFlags.DontSaveInEditor | HideFlags.NotEditable; sharedMaterials.Add(material); return material; }
void SetColor() { Color c = GroupIDs.IDToColor[groupIDs[0]]; GameObject gem = transform.Find("Gem").gameObject; SpriteGlow.SpriteGlowEffect glow = GetComponent <SpriteGlow.SpriteGlowEffect>(); if (gem != null) { gem.GetComponent <SpriteRenderer>().color = c; SpriteGlow.SpriteGlowEffect gemGlow = gem.GetComponent <SpriteGlow.SpriteGlowEffect>(); if (gemGlow != null) { gemGlow.GlowColor = c; } } if (glow != null) { glow.GlowColor = c; } }
// Start is called before the first frame update void Start() { mySpriteGlowEffect = gameObject.GetComponent <SpriteGlowEffect>(); DOTween.To(() => mySpriteGlowEffect.GlowBrightness, x => mySpriteGlowEffect.GlowBrightness = x, 8, 2.5f).SetLoops(-1, LoopType.Yoyo); }
private static bool IsSharedFor(SpriteGlowMaterial material, SpriteGlowEffect spriteGlow) { return(material.SpriteTexture == spriteGlow.Renderer.sprite.texture && material.DrawOutside == spriteGlow.DrawOutside && material.InstancingEnabled == spriteGlow.EnableInstancing); }