1 usingSystem;2 usingUnityengine;3 usingSystem.Collections;4 5 Public classTimecountdown:monobehaviour6 {7 8 //a point in time before9 Public LongStartTime =1379342120;Ten //time-limited seconds One Private LongFixedtime =200000; A Private LongNowtime; - - the - - //Use this for initialization - voidStart () + { -Nowtime = (System.datetime.now.ticks-system.datetime.parse ("1970-01-01"). Ticks)/10000000; + if(Nowtime-starttime >=fixedtime) A { atDebug.Log ("Countdown End"); - } - Else - { -Invokerepeating ("Countdown",0,1); - } in } - to //Update is called once per frame + voidUpdate () - { the * } $ Panax Notoginseng voidCountdown () - { theFixedtime-=1; +Gameobject.getcomponent<uilabel> (). Text = (Fixedtime/( -* -* -)). ToString () +"days" A+ ((fixedtime/ --Fixedtime/( -* -* -)* -* -)/ -). ToString () +"hours" the+ ((Fixedtime/ -) % -). ToString () +"points" ++ (fixedtime% -). ToString () +"seconds"; - } $}
Unity3d a simple Countdown