创建网站做搞笑视频,网站建设费用高,网站搜索框设计,做网站ssl证书必须要吗6.1 动画系统基础2-3_哔哩哔哩_bilibili p316 模型添加Animator组件 动画控制器
AnimatorController AnimatorController 可以通过代码控制动画速度 建立动画间的联系 bool值的设定
trigger p318
trigger点击的时候触发#xff0c;如喊叫#xff0c;开枪及换子弹等#x… 6.1 动画系统基础2-3_哔哩哔哩_bilibili p316 模型添加Animator组件 动画控制器
AnimatorController AnimatorController 可以通过代码控制动画速度 建立动画间的联系 bool值的设定
trigger p318
trigger点击的时候触发如喊叫开枪及换子弹等执行完成后自动回复原状态 通过代码调整动画播放速度 动画播放速度与某一个参数关联到一起 using System.Collections; using System.Collections.Generic; using UnityEngine; public class EthanController : MonoBehaviour { private Animator ani; private void Awake() { ani GetComponentAnimator(); } private void Update() { 动画参数名称可以转换为一个ID【int】 //int id Animator.StringToHash(CanMove); //Debug.Log(IDid); 设置后读取动画参数 //ani.SetBool(CanMove,true); [使用HashID进行参数的设置或读取效率更高] //ani.SetBool(id, true); //ani.SetFloat //ani.GetFloat //ani.SetInteger //ani.GetInteger //ani.SetTrigger //ani.SetTrigger [触发参数] ani.SetFloat(ShoutPlaySpeed, 2); ani.SetFloat(ShoutPlaySpeed,2,0.5f,Time.deltaTime); //按下方向键左键 if (Input.GetKeyDown(KeyCode.LeftArrow)) { ani.SetBool(CanMove, true); } if (Input.GetKeyDown(KeyCode.RightArrow)) { ani.SetBool(CanMove, false); } if (Input.GetKeyDown(KeyCode.Space)) { ani.SetTrigger(Shout); } if (Input.GetKey(KeyCode.S)) { //设置喊叫动画的播放速度,有0.5s过渡时间 ani.SetFloat(ShoutPlaySpeed,2,0.5f,Time.deltaTime); } } }