1 usingUnityengine;2 usingSystem.Collections;3 4 Public classBird:monobehaviour {5 Public floatTimer =0;6 Public intFreamnumbuer =Ten;7 Public intFreamcount=0;8 9 voidUpdate () {Ten //Bird Animation One if(Gamemangger._intance. GameState = =gamemangger.gamestate_runing) A { - { -Timer + =Time.deltatime; the if(Timer >=1.0f/Freamnumbuer) - { -freamcount++; -Timer-=1.0f/Freamnumbuer; + intFreamindex = freamcount%3; - This. Renderer.material.SetTextureOffset ("_maintex",NewVector2 (0.3333f* Freamindex,0)); + } A } at } - - //follow the left mouse button to realize the bird beating picture - if(Gamemangger._intance. GameState = =gamemangger.gamestate_runing) - { - { in if(Input.getmousebuttondown (0)) - { to Audio. Play (); +Vector3 vel02 = This. rigidbody.velocity; - This. rigidbody.velocity =NewVector3 (vel02.x,3, vel02.z); the } * } $ }Panax Notoginseng } - //Birds get Life the Public voidGetlife () + { ARigidbody.usegravity =true; theRigidbody.velocity =NewVector3 (3,0,0); + } -}
Fly Bird Case Code _bird