• Animation脚本


    ///***注:模型要设置类型为Legacy,否则动画不能播放


    //Unity制作的单个动画播放
    public class AnimationControl : MonoBehaviour { public Animation anim; public AnimationClip _anim; public Toggle BatteryTog; void Awake() { _anim.legacy = true; anim = GetComponent<Animation>(); anim["DCZ2"].speed = 0; } void Start() { EventTriggerListener.Get(BatteryTog.gameObject).onClick = PalyAnimation; } void PalyAnimation(GameObject game) { if (game.GetComponent<Toggle>().isOn) { anim["DCZ2"].normalizedTime = 0; anim["DCZ2"].speed = 1; anim.Play("DCZ2"); } else { anim["DCZ2"].speed = 0; } } }

      ///切割动画播放,动画中的每部分都挂载此脚本

    using UnityEngine;
    using System.Collections;
    
    public class AnimationControl : MonoBehaviour
    {
        public GameObject Game;
        public Animation _Anima;    
        public string animName;  
    
        void Start()
        {
            Debug.Log(animName);
        }
        void OnMouseDown()
        {
            PlayAnimation(animName);
        }
    
        void PlayAnimation(string str)
        {
            _Anima[str].speed = 1;
            _Anima[str].normalizedTime = 0;
            _Anima.Play(str);
            if (_Anima.IsPlaying(str) && _Anima[str].normalizedTime >= 1)
            {
                Game.SetActive(false);
            }
        }
    }
  • 相关阅读:
    选择排序
    冒泡排序
    排序算法
    排序的稳定性
    散列表查找的代码实现
    处理散列冲突的方法
    jQuery 实时监听input
    PhpStorm
    Memcache 学习
    豆瓣第三方登录
  • 原文地址:https://www.cnblogs.com/Cocomo/p/7053157.html
Copyright © 2020-2023  润新知