Using unityengine;using System.collections;public class Animationantisowing:monobehaviour {public static AnimationAnt Isowing _initialise; void Awake () {_initialise = this; }///<summary>////////</summary>//<param name= "Gameobject" > objects that need to play the animation </param>// /<param name= "Iszhengorfan" > Playback status of the animation </param>///<param Name= "Animation" > Animation status </param>// <returns></returns> public bool Ispositiveandnegativeplay (Gameobject Gameobject,bool Iszhengorfan, Animationstate animation) {//To determine the playback status of an incoming animation//----The incoming state is true, indicates that the normal play//----the incoming state is false, indicates that the animation has finished playing and can be played backwards if (!i Szhengorfan) {//When the animation is not playing, play the animation if (!gameobject.animation.isplaying) {GameObject.animation.Play ( ); -----Change the playback state of the animation-----//The current time of the animation is set to the initial Animation.time = 0f; The playback speed of the animation is normal speed animation.speed = 1.0f; Change the value of the passed bool variable Iszhengorfan = true; }} else {//when no animation is played, play the animation if (!gameobject.animation.isplaying) {gameObject.animation.Play (); -----Change the playback state of the animation-----//The current time of the animation is set to the duration of the animation animation.time = Animation.length; Backward, that is, the animation to play back, from the end point to the starting point play Animation.speed = -1.0f; Change the value of the passed bool variable Iszhengorfan = false; }} return Iszhengorfan; }}
The above is the whole content of this article to share, I hope you can enjoy.
In addition to the Declaration,
Running GuestArticles are original, reproduced please link to the form of the address of this article
Implement PRO/Con playback code for animations in unity
This address: http://www.paobuke.com/develop/c-develop/pbk23105.html
Related Content C # design Pattern templates Template method pattern implementation ASP. Password strength detection for the C # multi-thread thread class in C # programming using a prototype pattern in the design pattern for C # Read and write app. Configurationmanager.appsettings Non-effective solution
C # Methods for searching array elements using the foreach statement the most concise C # generation barcode picture ideas and examples share C # WinForm Program Exit Method Tips Summary C #. NET Implementation Currency conversion example
Implement PRO/Con playback code for animations in unity