Unity White cat Operation Small instance

Source: Internet
Author: User

Recently brother to me White cat operation how to do, 0.0 results White Cat No Android client can not play, read the next video introduction to simply do the next

:

Core code:

usingUnityengine;usingSystem.Collections;usingSystem.Collections.Generic;usingSystem; Public classTest:monobehaviour {PrivateTest () {}PrivateVector3 Startmousedown; PrivateVector3 Lastmousedown; Private floatPresstimer; Private BOOLIscounter;//Start Count    Private BOOLIsdrag;//Start dragging    Private BOOLislasting;//Start a Persistent click     Public floatPresstime;//Click     Public floatPresslastingtime;//Persistent clicks     Public floatDragdistance;//drag is greater than how much to begin to take effect    #regionEvent Public StaticAction<vector3>startpressevent;  Public StaticAction<vector3>endpressevent;  Public StaticAction<vector3>startdragevent;  Public StaticAction<vector3>enddragevent;  Public StaticAction<vector3>startlastingevent;  Public StaticAction<vector3>endlastingevent; #endregion    #regionTest methodvoidAwake () {startpressevent+=startpress; Endpressevent+=endpress; Startdragevent+=StartDrag; Enddragevent+=EndDrag; Startlastingevent+=startlasting; Endlastingevent+=endlasting; }    Private voidstartpress (Vector3 v) {Debug.Log ("Start Click event"); }    Private voidendpress (Vector3 v) {Debug.Log ("End Click event"); }    Private voidStartDrag (Vector3 v) {Debug.Log ("Start Drag Event"); }    Private voidEndDrag (Vector3 v) {Debug.Log ("End Drag Event"); }    Private voidstartlasting (Vector3 v) {Debug.Log ("start a Continuous click event"); }    Private voidendlasting (Vector3 v) {Debug.Log ("End Persistent Click event"); }    #endregion    //Update is called once per frame    voidUpdate () {if(Input.getmousebuttondown (0) ) {Iscounter=true; Startmousedown=input.mouseposition; }        if(Input.getmousebuttonup (0) ) {Lastmousedown=input.mouseposition; Iscounter=false; if(Isdrag) {//Drag                if(Enddragevent! =NULL) enddragevent (input.mouseposition); Isdrag=false; }            Else if(islasting) {//Persistent clicks                if(Endlastingevent! =NULL) endlastingevent (input.mouseposition); Islasting=false; }            Else             {                //Click                if(Endpressevent! =NULL) endpressevent (input.mouseposition); }        }        if(iscounter) {//Start CountPresstimer + =Time.deltatime; }        Else         {            if(Presstimer >0&& Presstimer <presstime) {Debug.Log ("Click"); if(Startpressevent! =NULL) startpressevent (input.mouseposition); } Presstimer=0f; }        if(Iscounter && mathf.abs (vector3.distance (Startmousedown, input.mouseposition)) > Dragdistance && Islasting = =false) {Debug.Log ("is dragging"); Isdrag=true; if(Startdragevent! =NULL) startdragevent (input.mouseposition); //let the character move in the direction of whose fingers            return; }        if(Iscounter && presstimer > presslastingtime && isdrag = =false) {Debug.Log ("Persistent clicks"); Islasting=true; if(Startlastingevent! =NULL) startlastingevent (input.mouseposition); //The skill icon appears and then slides to the skill to trigger the skill.                        return; }    }}

Unity5 + Ugui Production

Full Demo:http://yunpan.cn/cjhbiaxvzemax access Password 7607

Unity White cat Operation Small instance

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.