Unity AnimatorEvent

复制代码
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class AnimatorEvent : StateMachineBehaviour
{
    static int statePropertyId = Animator.StringToHash("State");
    static Dictionary<int, string> hashToName = new Dictionary<int, string>();
    static AnimatorEvent()
    {
       foreach (string name in new string[] { "eat", "hit", "animation"})
          hashToName.Add(Animator.StringToHash(name), name);
    }

    
    override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)
    {
       animator.SetInteger(statePropertyId, -1);
       
    }
}
相关推荐
天殇凉39 分钟前
AC自动机学习笔记
java·笔记·学习
TechTrek1 小时前
Spring Boot 4.0正式发布了
java·spring boot·后端·spring boot 4.0
飞梦工作室1 小时前
企业级 Spring Boot 邮件系统开发指南:从基础到高可用架构设计
java·spring boot·后端
haiyu柠檬1 小时前
在Spring Boot中实现Azure的SSO+VUE3前端配置
java·spring boot·后端
百***81272 小时前
【SpringBoot】SpringBoot中分页插件(PageHelper)的使用
java·spring boot·后端
百***86462 小时前
SpringBoot中自定义Starter
java·spring boot·后端
q***07142 小时前
VScode 开发 Springboot 程序
java·spring boot·后端
q***46522 小时前
Spring中使用Async进行异步功能开发实战-以大文件上传为例
java·后端·spring
q***38512 小时前
SpringCloud实战【九】 SpringCloud服务间调用
java·spring boot·spring cloud
岚天start2 小时前
K8S环境中Containerd运行时占用文件定位清理
java·rpc·kubernetes