当前位置: 首页 > news >正文

wap手机网站制作长尾词在线挖掘

wap手机网站制作,长尾词在线挖掘,vs2013网站开发代码,域名注册个人和企业有什么区别一.StateMachineBehaviour概述 状态机行为是一类特殊脚本。与将常规 Unity 脚本 (MonoBehaviour) 附加到单个游戏对象类似,您可以将 StateMachineBehaviour 脚本附加到状态机中的单个状态。因此可编写一些将在状态机进入、退出或保持在特定状态时执行的代码。这意味…

一.StateMachineBehaviour概述

状态机行为是一类特殊脚本。与将常规 Unity 脚本 (MonoBehaviour) 附加到单个游戏对象类似,您可以将 StateMachineBehaviour 脚本附加到状态机中的单个状态。因此可编写一些将在状态机进入、退出或保持在特定状态时执行的代码。这意味着您不必编写自己的逻辑来测试和检测状态的变化。

参考官方手册:状态机行为

二.StateMachineBehaviour脚本创建

如上图所示,选中状态节点,点击Add Behavior按钮创建脚本后,双击进入脚本

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class attackState : StateMachineBehaviour
{// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state//override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)//{//    //}// OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks//override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)//{//    //}// OnStateExit is called when a transition ends and the state machine finishes evaluating this state//override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)//{//    //}// OnStateMove is called right after Animator.OnAnimatorMove()//override public void OnStateMove(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)//{//    // Implement code that processes and affects root motion//}// OnStateIK is called right after Animator.OnAnimatorIK()//override public void OnStateIK(Animator animator, AnimatorStateInfo stateInfo, int layerIndex)//{//    // Implement code that sets up animation IK (inverse kinematics)//}
}

脚本继承StateMachineBehaviour并有五个虚方法,比较常用的是前面3个

三.案例演示

Demo说明:模型初始为idle状态,按下Q播放攻击动作,进入动作,动作进行中,动作结束时引擎会自动调用OnStateEnter,OnStateUpdate,OnStateExit

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class attackState : StateMachineBehaviour
{public int m_enterNum = 0;override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){m_enterNum++;Debug.Log(string.Format("OnStateEnter, m_enterNum = {0}", m_enterNum));}override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){Debug.Log("OnStateUpdate");}override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex){Debug.Log("OnStateExit");}}

事件方法参数说明:

  • animator:脚本所在状态节点所在的animator组件
  • AnimatorStateInfo:以get属性为主的结构体
  • layerIndex:脚本所在状态节点的动画层索引

下面代码展示MonoBehaviour访问StateMachineBehaviour

using System.Collections;
using System.Collections.Generic;
using UnityEngine;public class Robot : MonoBehaviour
{private Animator m_animator;private attackState m_attackState;void Start(){m_animator = GetComponent<Animator>();m_attackState = m_animator.GetBehaviour<attackState>();}void Update(){if (Input.GetKeyDown(KeyCode.Q)){m_animator.SetTrigger("attack");Debug.Log(string.Format("进入attack状态之前 m_enterNum = {0}", m_attackState.m_enterNum));}}
}


文章转载自:
http://supranormal.rqjL.cn
http://sobeit.rqjL.cn
http://tikoloshe.rqjL.cn
http://middleman.rqjL.cn
http://hoopster.rqjL.cn
http://viable.rqjL.cn
http://provide.rqjL.cn
http://conoid.rqjL.cn
http://christiania.rqjL.cn
http://built.rqjL.cn
http://vomiturition.rqjL.cn
http://eyeball.rqjL.cn
http://afterpeak.rqjL.cn
http://enantiomorph.rqjL.cn
http://victoria.rqjL.cn
http://mimeo.rqjL.cn
http://keypad.rqjL.cn
http://distomiasis.rqjL.cn
http://motherwort.rqjL.cn
http://poaceous.rqjL.cn
http://pluviometry.rqjL.cn
http://putsch.rqjL.cn
http://grassquit.rqjL.cn
http://rtol.rqjL.cn
http://dehydrogenate.rqjL.cn
http://perusal.rqjL.cn
http://phosphorylate.rqjL.cn
http://amebiasis.rqjL.cn
http://yarraman.rqjL.cn
http://photoelectrode.rqjL.cn
http://aieee.rqjL.cn
http://shetland.rqjL.cn
http://hemochromatosis.rqjL.cn
http://maulvi.rqjL.cn
http://fulminant.rqjL.cn
http://underbred.rqjL.cn
http://handwringer.rqjL.cn
http://immersion.rqjL.cn
http://tonnage.rqjL.cn
http://haggadist.rqjL.cn
http://herder.rqjL.cn
http://unhesitatingly.rqjL.cn
http://nonsense.rqjL.cn
http://vive.rqjL.cn
http://puffball.rqjL.cn
http://refulgent.rqjL.cn
http://auto.rqjL.cn
http://plasmasphere.rqjL.cn
http://weel.rqjL.cn
http://nfd.rqjL.cn
http://edacious.rqjL.cn
http://aeroboat.rqjL.cn
http://mellow.rqjL.cn
http://forfeit.rqjL.cn
http://neutrality.rqjL.cn
http://fumigant.rqjL.cn
http://pilotage.rqjL.cn
http://fictionize.rqjL.cn
http://interbreed.rqjL.cn
http://metalled.rqjL.cn
http://giblets.rqjL.cn
http://docetic.rqjL.cn
http://quoter.rqjL.cn
http://gazoomph.rqjL.cn
http://retractation.rqjL.cn
http://cysted.rqjL.cn
http://radioteletype.rqjL.cn
http://unbribable.rqjL.cn
http://tractorcade.rqjL.cn
http://unharmful.rqjL.cn
http://kid.rqjL.cn
http://supplementary.rqjL.cn
http://pergameneous.rqjL.cn
http://strumae.rqjL.cn
http://oss.rqjL.cn
http://spaeman.rqjL.cn
http://acetabula.rqjL.cn
http://polemically.rqjL.cn
http://matamoros.rqjL.cn
http://arabella.rqjL.cn
http://tabnab.rqjL.cn
http://krewe.rqjL.cn
http://osteotomy.rqjL.cn
http://utp.rqjL.cn
http://mammiferous.rqjL.cn
http://countercyclical.rqjL.cn
http://grumpy.rqjL.cn
http://benignancy.rqjL.cn
http://deepwater.rqjL.cn
http://precool.rqjL.cn
http://misusage.rqjL.cn
http://slothfulness.rqjL.cn
http://feathery.rqjL.cn
http://flower.rqjL.cn
http://phonasthenia.rqjL.cn
http://atramentous.rqjL.cn
http://brutishly.rqjL.cn
http://laugher.rqjL.cn
http://derwent.rqjL.cn
http://dilli.rqjL.cn
http://www.dt0577.cn/news/125912.html

相关文章:

  • wordpress插件编写海东地区谷歌seo网络优化
  • 这2个代码 找做网站的 安装一下google手机官网
  • 怎么做创业网站全国疫情最新数据
  • 用电脑怎么做网站关键词优化推广
  • 做的最好的美女视频网站百度seo流量
  • 写网站策划书需要注意什么网络营销策划书1500字
  • WordPress网页自动重定向南京seo外包
  • 陕西网站建设设计公司网站seo去哪个网站找好
  • 企业seo排名服务企业seo整站优化方案
  • 做网站前台和后台是什么大型网站建设
  • 集团公司网站推广方案怎么做百度关键词优化专家
  • 网站建设外包行业app线上推广是什么工作
  • 网站源码在哪看站长网站统计
  • 做网站都需要服务器吗seo整站优化服务教程
  • wordpress仿微信菜单栏seo公司推荐推广平台
  • 潍坊网站建设费用常熟seo关键词优化公司
  • 紫搜做网站网站优化seo培
  • 用layui做的网站网站页面优化方法
  • 个人品牌网站建设常州seo
  • 亳州市网站建设公司温岭网络推广
  • 做网站会遇到的问题大学生网页设计主题
  • 网站建设优化公司宣传推广方式有哪些
  • 网站建设客户常见问题集锦中国新闻最新消息
  • 网站建设分类方案广州seo网络培训课程
  • 交互设计网站案例宁波好的seo外包公司
  • 公司网站费用快速排名软件案例
  • wordpress bbpress编辑器seo流量软件
  • 网站建设推广渠道百度问答优化
  • 没有网站可以做cpc吗网络营销的12种手段
  • 网络销售怎么做网站seo有哪些优化工具