void Start() { _MyProperty = gameObject.GetComponent <Ctrl_BaseEnemy_Prop_Old>(); //得到本身属性 _MyAI = gameObject.GetComponent <Ctrl_SkeletonWarrior_AI_Old>(); _MyAnimator = gameObject.GetComponent <Animator>(); //得到动画状态机 goHero = GameObject.FindGameObjectWithTag(Tag.Tag_Player); _cc = this.gameObject.GetComponent <CharacterController>(); if (goHero) { _HeroProperty = goHero.GetComponent <Ctrl_HeroProperty>(); //得到英雄的属性脚本 } }
private void Start() { //得到主角 _GoHero = GameObject.FindGameObjectWithTag(Tag.Tag_Player); //当前范围 _MyTransform = this.gameObject.transform; //得到“属性”实例 _MyProperty = this.gameObject.GetComponent <Ctrl_BaseEnemy_Prop_Old>(); _MyAnimator = this.gameObject.GetComponent <Animator>(); //得到角色控制器 _cc = this.gameObject.GetComponent <CharacterController>(); //确定个体差异性参数 FloMinIdleDist = UnityHelper.GetInstance().GetRandomNum(5, 10); FloThinkTime = UnityHelper.GetInstance().GetRandomNum(1, 4); ////这个两个协程应该只在自然状态(例如,非受伤)下进行 ////如果不是则结束,如果又是则重新开始 ////开始思考协程 //StartCoroutine("ThinkProcess"); ////开始移动协程 //StartCoroutine("MovingProcess"); }