The animation of the battle-fighting number enhancement.

Source: Internet
Author: User

1 usingUnityengine;2 usingSystem.Collections;3 4  Public classFrightup_panlemng:monobehaviour {5 6    //Public static frightup_panlemng Instance;7 8     //Time9      Public floatTime_miao =2f;Ten  One      PublicUILabel frightnum;//Fighting capacity label A  -      PublicTweenalpha tweenalpha;//Show hidden tween animations -  the     floatStart =0;//Start Value -     floatEnd =0;//End Value -  -     floatSpeed=0;//Speed +  -     voidAwake () +     { A       //Instance = this; at  -  -  -        -     } -  in     voidStart () -     { toPlayerInfo.Instance.OnPlayerInfoChanged + = This. onplayerinfochanged;//Registering events, +  -Start =playerinfo.instance.fright;//Get the starting combat value the  *Gameobject.setactive (false);//Hide First $     }Panax NotoginsengEvent method -      Public voidonplayerinfochanged (infotype infotype) the     { +         if(infotype==infotype.frightnum)//If the type is combat effectiveness A         { the Show (); +         } -     } $  $      Public voidShow () -     { -End =playerinfo.instance.fright;//get the fighting power now theSpeed = (End-start)/time_miao;//Calculating the speed -Gameobject.setactive (true);//ActivationWuyi Tweenalpha. Playforward ();//Display animation the Startcoroutine (Ieshow ());//start co-process -     } Wu  - IEnumerator ieshow () About     { $          -          while(start!=end) - {//When the end and start gaps are less than the speed, -             if(End>start&&end-start < speed) | | (End<start) &&start-end<mathf.abs (speed)) A {//directly equals end +Start =end; the             } -             Else $ {//otherwise add speed * per frame theStart + = speed *Time.deltatime; the             } theLabel Assignment theFrightnum.text = ((int) Start). ToString (); -Wait for a frame in             yield return 0; the         } the Tweenalpha. Playreverse ();//Play The hidden animation at the end of the loop AboutWait for the animation to finish playing the         yield return NewWaitforseconds (0.7f); theDisable theGameobject.setactive (false); +     } -  the}

The animation of the battle-fighting number enhancement.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.