void drawAnimation(LumarcaAnimation la) { LumarcaFrame lf = la.GetCurrentFrame(); foreach (LumarcaLine ll in lf.lines) { if (ll.hasDots) { DrawLine(ll.top, ll.bottom, MaterialCache.GetMaterial(ll.material)); } else { DrawLineWithoutDots(ll.top, ll.bottom, MaterialCache.GetMaterial(ll.material)); } } }
void UpdateMaterial() { if (SpriteRenderer?.sprite == null) { return; } var sprite = SpriteRenderer.sprite; if (LastSprite == sprite) { return; } var data = MaterialCache.GetMaterial(sprite); if (data == null) { Logger.LogWarning($"GetMaterial returned null"); return; } CurrentMaterial = new Material(data.Material); MeshRenderer.material = CurrentMaterial; UpdateMaterialColour(); if (SpriteRenderer.flipX) { data.Width *= -1; data.XPos *= -1; } if (SpriteRenderer.flipY) { data.Height *= -1; data.YPos *= -1; } transform.localScale = new Vector3(data.Width, data.Height, 1); transform.localPosition = new Vector3(data.XPos, data.YPos, 0); LastSprite = sprite; }