Esempio n. 1
0
 /// <summary>
 /// This function should perform all necessary cleanup. It is expected that the [this.tween]
 /// reference will be NULL after this function completes.
 /// </summary>
 protected void cleanup()
 {
     if (tween != null)
     {
         tween.Stop();
         tween.Release();
         tween = null;
     }
 }
Esempio n. 2
0
        protected override void Init()
        {
            InitLabel();

            tweenShake = FindInChild <TweenShake>();
            btn_close  = FindInChild <Button>("btn_close");
            goods.Add(FindInChild <Transform>("Awards/Goods/1"));
            goods.Add(FindInChild <Transform>("Awards/Goods/2"));
            goods.Add(FindInChild <Transform>("Awards/Goods/3"));
            goods.Add(FindInChild <Transform>("Awards/Goods/4"));
            goods.Add(FindInChild <Transform>("Awards/Goods/5"));
            lifeAchievement = FindInChild <UISprite>("Achievement/life");
            timeAchievement = FindInChild <UISprite>("Achievement/time");
            killAchievement = FindInChild <UISprite>("Achievement/kill");
            recExpValue     = FindInChild <UILabel>("Awards/Exp/value");
            recMoneyValue   = FindInChild <UILabel>("Awards/Money/value");
            recSoulValue    = FindInChild <UILabel>("Awards/Soul/value");
            role            = FindInChild <Transform>("Background/role");

            star1      = FindChild("Achievement/Stars/star1");
            star2      = FindChild("Achievement/Stars/star2");
            star3      = FindChild("Achievement/Stars/star3");
            Exp        = FindChild("Awards/Exp");
            Soul       = FindChild("Awards/Soul");
            Goods      = FindChild("Awards/Goods");
            Money      = FindChild("Awards/Money");
            expTween   = FindInChild <TweenPosition>("Awards/Exp");
            soulTween  = FindInChild <TweenPosition>("Awards/Soul");
            moneyTween = FindInChild <TweenPosition>("Awards/Money");
            goodsTween = FindInChild <TweenPosition>("Awards/Goods");
            star1Tween = FindInChild <TweenAlpha>("Achievement/Stars/star1");
            star2Tween = FindInChild <TweenAlpha>("Achievement/Stars/star2");
            star3Tween = FindInChild <TweenAlpha>("Achievement/Stars/star3");
            playstar1  = FindInChild <TweenPlay>("Achievement/Stars/star1");
            playstar2  = FindInChild <TweenPlay>("Achievement/Stars/star2");
            playstar3  = FindInChild <TweenPlay>("Achievement/Stars/star3");
            playExp    = FindInChild <TweenPlay>("Awards/Exp");
            playSoul   = FindInChild <TweenPlay>("Awards/Soul");
            playGoods  = FindInChild <TweenPlay>("Awards/Goods");
            playMoney  = FindInChild <TweenPlay>("Awards/Money");

            remainTimeValue = FindInChild <UILabel>("QuitCopy/value");

            achievementPos.Add(timeAchievement.transform.localPosition);
            achievementPos.Add(lifeAchievement.transform.localPosition);
            achievementPos.Add(killAchievement.transform.localPosition);
            btn_close.onClick += CloseOnClick;
            for (int i = 0; i < goods.Count; ++i)
            {
                goods[i].GetComponent <Button>().onClick = GoodsOnClick;
            }
        }
    void Start()
    {
        shake = TweenShake.Obtain()
            .SetStartValue( Camera.position )
            .SetDuration( 1f )
            .SetShakeMagnitude( 0.25f )
            .SetShakeSpeed( 13f )
            .SetTimeScaleIndependent( true )
            .OnExecute( ( result ) => { Camera.position = new Vector3( result.x, result.y, Camera.position.z ); } );

        fallTween = this.TweenPosition()
            .SetStartValue( transform.position + Vector3.up * 5f )
            .SetEasing( TweenEasingFunctions.EaseInExpo )
            .SetDuration( 1f )
            .SetDelay( 0.25f )
            .SetTimeScaleIndependent( true )
            .OnCompleted( ( sender ) => { shake.Play(); } )
            .Play();
    }
Esempio n. 4
0
 /// <summary>
 /// Returns a dfTweenShake instance that is configured to shake a transform's position
 /// </summary>
 public static TweenShake ShakePosition(this Transform transform, bool localPosition)
 {
     return(TweenShake.Obtain()
            .SetStartValue(localPosition ? transform.localPosition : transform.position)
            .SetShakeMagnitude(0.1f)
            .SetDuration(1f)
            .SetShakeSpeed(10f)
            .OnExecute((result) =>
     {
         if (localPosition)
         {
             transform.localPosition = result;
         }
         else
         {
             transform.position = result;
         }
     }));
 }
Esempio n. 5
0
        protected void configureTween()
        {
            var camera = gameObject.GetComponent <Camera>();

            if (this.tween == null)
            {
                this.tween = (TweenShake)
                             camera.ShakePosition(true)
                             .OnStarted((x) => { onStarted(); })
                             .OnStopped((x) => { onStopped(); })
                             .OnPaused((x) => { onPaused(); })
                             .OnResumed((x) => { onResumed(); })
                             .OnLoopCompleted((x) => { onLoopCompleted(); })
                             .OnCompleted((x) => { onCompleted(); });
            }

            this.tween
            .SetDelay(this.startDelay)
            .SetDuration(this.Duration)
            .SetShakeMagnitude(this.ShakeMagnitude)
            .SetShakeSpeed(this.ShakeSpeed);
        }