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);
       
    }
}
相关推荐
薛定谔的猫喵喵13 小时前
Spring Boot Jar包修改配置文件和Class中硬编码IP的完整指南
java·spring boot·反编译·class
Seven9713 小时前
Tomcat Request请求处理过程:Connector
java
Mr数据杨13 小时前
【Codex】搭建教学中心数据工作台统筹教案与课件资源
java·开发语言·django·codex·项目开发
摇滚侠14 小时前
Java 项目教程《黑马商城》服务治理 11 - 14
java·微服务·架构
一只大袋鼠14 小时前
Spring 事务管理三种实现方式
java·数据库·spring·声明式事务
郝学胜-神的一滴14 小时前
高并发秒杀系统设计全解:从需求拆解到Redis库存实战
java·数据库·redis·python·程序人生·缓存·php
NE_STOP14 小时前
Redis--哨兵机制与CAP定理
java
书源丶14 小时前
四十二、网络编程(上)——IP、端口与 UDP 编程
java·网络·tcp/ip·udp
m0_7108908714 小时前
2026 年进销存系统大盘点:国内外 5 款主流进销存软件对比与选型指南
java·数据库·mysql
devilnumber14 小时前
maven依赖的直接下载jar
java·maven