Esempio n. 1
0
 private PiecewiseRender NewPiecewise(StandLocation rootSR, DialogueSprite sprite)
 {
     if (renders.TryGetValue(rootSR, out var pr))
     {
         pr.DestroySpawned();
     }
     else
     {
         renders[rootSR] = pr = new PiecewiseRender();
     }
     pr.Restructure(Target(rootSR), sprite);
     return(pr);
 }
Esempio n. 2
0
            public void Restructure(SpriteRenderer rootSR, DialogueSprite sprite)
            {
                var tr        = rootSR.transform;
                var rootOrder = rootSR.sortingOrder;
                var layer     = rootSR.gameObject.layer;

                spriteRenders = sprite.sprites.Where(x => x.sprite != null).Select(s => {
                    var go = new GameObject {
                        layer = layer
                    };
                    go.transform.SetParent(tr, false);
                    go.transform.localPosition = s.offset * (1 / s.sprite.pixelsPerUnit) + new Vector2(0f, lastBop);
                    var sr             = go.AddComponent <SpriteRenderer>();
                    sr.sprite          = s.sprite;
                    sr.sortingOrder    = ++rootOrder;
                    sr.maskInteraction = rootSR.maskInteraction;
                    sr.sortingLayerID  = rootSR.sortingLayerID;
                    return(sr);
                }).ToArray();
            }