您好,欢迎来到榕意旅游网。
搜索
您的当前位置:首页Animator 多个镜头切换

Animator 多个镜头切换

来源:榕意旅游网

using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;

public class Test : MonoBehaviour
{
    private Animator demo;
    private bool stop;
    // Start is called before the first frame update
    void Start()
    {

        demo = transform.GetComponent<Animator>();
    }

    // Update is called once per frame
    void Update()
    {
       
        if (stop == false)
        {
          
            if (Input.GetKeyDown(KeyCode.F1))
            {
                print("deee");
                demo.SetFloat("speed", 1);
                demo.Play("Move");
                stop = true;
            }
            if (Input.GetKeyDown(KeyCode.F2))
            {
                demo.SetFloat("speed", 1);

                demo.Play("Move1");
                stop = true;
            }
            if (Input.GetKeyDown(KeyCode.F3))
            {
                demo.SetFloat("speed", 1);

                demo.Play("Move2");
                stop = true;
            }
           
        }
        else
        {
            if (Input.GetMouseButtonDown(2))
            {
                StartCoroutine(Back());
            }
        }
      
    }
    IEnumerator Back()
    {
       
        demo.SetFloat("speed", -1);
        demo.Play(demo.GetCurrentAnimatorClipInfo(0)[0].clip.name);
        yield return new WaitForSeconds(demo.GetCurrentAnimatorClipInfo(0)[0].clip.length);
       
        stop = false;
    }
}

 

因篇幅问题不能全部显示,请点此查看更多更全内容

Copyright © 2019- nryq.cn 版权所有 赣ICP备2024042798号-6

违法及侵权请联系:TEL:199 1889 7713 E-MAIL:2724546146@qq.com

本站由北京市万商天勤律师事务所王兴未律师提供法律服务