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);
       
    }
}
相关推荐
一灯架构3 小时前
90%的人答错!一文带你彻底搞懂ArrayList
java·后端
mxwin4 小时前
Unity URP 下抓取当前屏幕内容实现扭曲、镜子与全局模糊效果
unity·游戏引擎·shader
Y4090014 小时前
【多线程】线程安全(1)
java·开发语言·jvm
布局呆星5 小时前
SpringBoot 基础入门
java·spring boot·spring
风吹迎面入袖凉5 小时前
【Redis】Redisson的可重入锁原理
java·redis
w6100104665 小时前
cka-2026-ConfigMap
java·linux·cka·configmap
语戚6 小时前
力扣 968. 监控二叉树 —— 贪心 & 树形 DP 双解法递归 + 非递归全解(Java 实现)
java·算法·leetcode·贪心算法·动态规划·力扣·
quxuexi6 小时前
网络通信安全与可靠传输:从加密到认证,从状态码到可靠传输
java·安全·web
hrhcode7 小时前
【java工程师快速上手go】二.Go进阶特性
java·golang·go