Beispiel #1
0
        public void StartFly(string score, Vector3 wPos)
        {
            scoreText.text = score;
            Canvas c = GameObject.Find("CanvasMain").GetComponent <Canvas>();

            rTransform.SetParent(c.transform);
            rTransform.anchoredPosition = Coordinats.WorldToCanvasCenterCenter(wPos, c);
            Vector2 pos  = rTransform.anchoredPosition;
            float   dist = Random.Range(300, 500);
            float   time = Random.Range(1.2f, 2.2f);

            SimpleTween.Value(gameObject, 0f, dist, time).SetOnUpdate((float val) =>
            {
                Vector2 npos = pos + new Vector2(0, val);
                if (this)
                {
                    rTransform.anchoredPosition = npos;
                }
            }).SetEase(EaseAnim.EaseOutCubic).
            SetDelay(Random.Range(0.0f, 0.1f)).
            AddCompleteCallBack(() =>
            {
                if (this)
                {
                    Destroy(gameObject);
                }
            });
        }
Beispiel #2
0
        // Use this for initialization
        public void StartFly(string score, Vector3 wPos)
        {
            scoreText.text = score;
            Canvas c = GameObject.Find("CanvasMain").GetComponent <Canvas>();

            rTransform.SetParent(c.transform);
            rTransform.anchoredPosition = Coordinats.WorldToCanvasCenterCenter(wPos, c);
            Vector2 pos = rTransform.anchoredPosition;

            SimpleTween.Value(gameObject, 0f, 500f, 2f).SetOnUpdate((float val) =>
            {
                Vector2 npos = pos + new Vector2(0, val);
                rTransform.anchoredPosition = npos;
            }).SetEase(EaseAnim.EaseOutCubic).AddCompleteCallBack(() =>
            {
                Destroy(gameObject);
            });
        }