コード例 #1
0
        /** Creates a PotaTween component to play the preset */
        public PotaTween Initialize(GameObject gameObject, int id = 0)
        {
            this.gameObject = gameObject;
            this.transform  = gameObject.transform;

            PotaTween tween = PotaTween.Create(this.gameObject, id);

            tween.Tag                = Tag;
            tween.PlayOnEnable       = PlayOnEnable;
            tween.PlayOnStart        = PlayOnStart;
            tween.Duration           = Duration;
            tween.Speed              = Speed;
            tween.Delay              = Delay;
            tween.Loop               = Loop;
            tween.LoopsNumber        = LoopsNumber;
            tween.EasingReference    = EasingReference;
            tween.EaseEquation       = EaseEquation;
            tween.Curve              = Curve;
            tween.FlipCurveOnReverse = FlipCurveOnReverse;

            tween.Position = Position;
            tween.Rotation = Rotation;
            tween.Scale    = Scale;
            tween.Color    = Color;
            tween.Alpha    = Alpha;
            tween.Float    = Float;

            tween.onStart    = onStart;
            tween.onComplete = onComplete;

            return(tween);
        }
コード例 #2
0
ファイル: PotaTween.cs プロジェクト: Cogito09/TestProjectG
        /// <summary>
        /// Creates a new PotaTween, or returns an existing with the same target and id.
        /// </summary>
        /// <param name="target">GameObject that the tween will be attached to.</param>
        /// <param name="id">Id of the tween for reference.</param>
        public static PotaTween Create(GameObject target, int id = 0)
        {
            PotaTween[] tweens = target.GetComponents <PotaTween>();

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

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

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

            return(tween);
        }