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);
       
    }
}
相关推荐
QQ_216962909610 分钟前
Spring Boot 养老院管理系统:从入住、护理到费用结算的全流程实现(源码可领)
java·spring boot·后端
cxoptics27 分钟前
冰洲石分束器设计与应用
java
ck-joker42 分钟前
M1 Pro跑LLM实测:Ollama+LangChain4j零成本本地大模型开发,比云端API快在哪?
java·语言模型
丙氨酸長鏈1 小时前
[Bukkit插件开发]手持发射器箭矢机枪 教学文档 面向Python/C#开发者入门Java与Bukkit API
java·python·c#
Nontee1 小时前
设计模式:模板方法与策略,从“每个字都认识“到能说清它们在干嘛
java·数据库·设计模式
淡海水1 小时前
12-01-YooAsset工程化-Unity资源管理规范
unity·c#·游戏引擎·yooasset
我是唐青枫1 小时前
Java ReentrantLock 实战详解:比 synchronized 更灵活的可重入锁
java·开发语言
晨曦中的暮雨2 小时前
Virtual Thread 优化 Spring AI 阻塞式 LLM I/O:对照压测报告
java·并发·个人项目
AKA__Zas3 小时前
芝士算法(前缀和2.0)
java·数据结构·算法·leetcode·哈希算法·学习方法
caishenzhibiao3 小时前
降雨带波段点差 同花顺期货通指标
java·c语言·c#