Implement PRO/Con playback code for animations in unity

Source: Internet
Author: User
Tags thread class

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

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.