コード例 #1
0
        public static PYTweenAnimation Add(GameObject target, bool addRigidbody = true)
        {
            if (!target.GetComponent <PYTweenAnimation>())
            {
                target.AddComponent <PYTweenAnimation>();
            }

            PYTweenAnimation tween = target.GetComponent <PYTweenAnimation>();

            if (addRigidbody && target.GetComponent <Collider2D>() && !target.GetComponent <Rigidbody2D>())
            {
                tween._rigidbody2D             = target.AddComponent <Rigidbody2D>();
                tween._rigidbody2D.isKinematic = true;
            }

            tween.Initialize();

            return(tween);
        }
コード例 #2
0
        public static PYTweenAnimation AddNew(GameObject target, int id = 1)
        {
            PYTweenAnimation[] tweens = target.GetComponents <PYTweenAnimation>();

            if (tweens != null)
            {
                for (int i = 0; i < tweens.Length; i++)
                {
                    if (tweens[i].Id == id)
                    {
                        return(tweens[i]);
                    }
                }
            }

            PYTweenAnimation tween = target.AddComponent <PYTweenAnimation>();

            tween.Id = id;
            tween.Initialize();

            return(tween);
        }