コード例 #1
0
 //移动
 public void Movement(float horizontal, float vertical)
 {
     if (horizontal != 0 || vertical != 0)
     {
         chAnimation.PlayAnimation("run");
         Rotating(horizontal, vertical);
         var direct = new Vector3(transform.forward.x, -1, transform.forward.z);
         ch.Move(direct * speed * Time.deltaTime);
     }
     else
     {
         chAnimation.PlayAnimation("idle");
     }
 }
コード例 #2
0
 /// <summary>
 /// 使用指定技能
 /// </summary>
 /// <param name="skillid">技能编号</param>
 /// <param name="isBatter">是否连击</param>
 public void AttackUseSkill(int skillid, bool isBatter)
 {
     //如果是连击,找当前技能的下一个连击技能
     if (currentUseSkill != null && isBatter)
     {
         skillid = currentUseSkill.nextBatterId;
     }
     //准备技能
     currentUseSkill = chSkillMgr.PrepareSkill(skillid);
     if (currentUseSkill != null)
     {
         //目标选择
         var selectedTaget = SelectTarget();
         if (selectedTaget != null)
         {
             //目标选中指示的显隐
             if (currentSelectedTarget != null)
             {
                 TransformHelper.FindChild(currentSelectedTarget, "selected").GetComponent <Renderer>().enabled = false;
             }
             currentSelectedTarget = selectedTaget.transform;
             TransformHelper.FindChild(currentSelectedTarget, "selected").GetComponent <Renderer>().enabled = true;
             //转向目标
             transform.LookAt(currentSelectedTarget);
         }
         //攻击动画
         chAnim.PlayAnimation(currentUseSkill.animtionName);
     }
 }
コード例 #3
0
 /// <summary>
 /// 重写父类的死亡方法
 /// </summary>
 /// <param name="killer">杀手</param>
 public override void Dead(GameObject killer)
 {
     if (HP <= 0)
     {
         var status = killer.GetComponent <PlayerStatus>();
         if (status != null)
         {
             status.CollectExp(this.giveExp);
         }
         chAnim.PlayAnimation("death");
         //FightingStatistics.Instance.DeleteEnemy(gameObject);	//add怪物死亡后清除列表
         //销毁
         GameObject.Destroy(gameObject, 3);
     }
 }
コード例 #4
0
 public override void Dead(GameObject killer)
 {
     chAnim.PlayAnimation("dead");
     UIManager.Instance.SetVisible(UIName.UIBattleOver, true);
 }
コード例 #5
0
 public override void Dead(GameObject killer)
 {
     chAnim.PlayAnimation("death");
     Debug.Log("英雄死亡");
     //UIManager.Instance.SetVisible(UIName.UIBattleOver, true);	////add显示失败面板
 }