Demon_ animation control (to move around before and after the implementation, shouting)

Source: Internet
Author: User

usingUnityengine;usingSystem.Collections; Public classPlayeranimation:monobehaviour {floatver; PrivateAnimator ANI; voidAwake () {ANI= getcomponent<animator> (); }    voidUpdate () {ver= Input.getaxis ("Vertical"); //set animation state machine Parameters//ANI. Setinteger ("number", (int) mathf.abs (ver));Ani. Setinteger (HashIDs.instance.Number, (int) Mathf.abs (ver)); //Front key, character facing forward, rear key, character facing back        if(Ver >0) {Transform.eulerangles=Vector3.zero; } Else if(Ver <0) {Transform.eulerangles= Vector3.up * the; }        //Press the space and the player shouts        if(Input.getkeydown (keycode.space)) {ani. Settrigger ("Shout"); }    }}

The above script mounts the characters to achieve the effect of controlling task execution animation.

The next step is to set the animation's speed assignment

usingUnityengine;usingSystem.Collections; Public classHashids:monobehaviour { Public StaticHashids instance; voidAwake () {instance= This; }     Public intSpeed ;  Public intNumber ;  Public intIdle;  Public intRun; voidStart () { speed= Animator.stringtohash (" Speed"); number= Animator.stringtohash (" Number"); Idle= Animator.stringtohash ("Idle"); Run= Animator.stringtohash ("Run"); }}

Demon_ animation control (to move around before and after the implementation, shouting)

Related Article

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.