Пример #1
0
 public void ChangePreview(UnitGraphics animationManager)
 {
     //RemoveGraphics();
     if (preview)
     {
         Destroy(preview.gameObject);
     }
     preview = Instantiate(animationManager, transform);
     preview.transform.localScale    = Vector3.one;
     preview.transform.localPosition = Vector3.zero;
     preview.SetSortingLayer("Preview");
 }
Пример #2
0
    public void PlacePreview(GizmoidData data, UnitGraphics preview)
    {
        float duration = 0.5f;

        preview.transform.SetParent(transform);
        Vector3 rot = Vector3.zero;

        if (transform.localEulerAngles.z > 180f)
        {
            rot = new Vector3(0, 0, 359.9f);
        }
        preview.SetSortingLayer("Gizmoid" + gizmoids.Count);

        sequence = DOTween.Sequence();
        sequence.Join(preview.transform.DOLocalMove(new Vector3(0, blade.radiusOffset + (GetSpacing() * gizmoids.Count), 0), duration).SetEase(DG.Tweening.Ease.OutBounce))
        .Join(preview.transform.DOLocalRotate(rot, duration).SetEase(DG.Tweening.Ease.OutQuart))
        .OnComplete(() => BuildGizmoid(data, preview));
    }