//***************翻滚 public void Rush() { if (!land) { return; //如果处于悬空状态则不能翻滚 } if (energy < 10) { GameManager.Instance.Tip("能量不足"); return; } ChangeEnergyValue(-10); rushButton.ResetCD(); //技能进入冷却 DisableMove(); animator.SetFloat("RollSpeed", 0.5f * moveSpeed / 6 + 0.2f); //滚动速度转换式 animator.Play("Roll"); Invoke("EnableMove", 5 / (moveSpeed * 2)); //检测前方是否有碰撞体 RaycastHit hit; if (Physics.Raycast(transform.position + Vector3.up * 0.5f, transform.forward, out hit, rushDistance)) { //print("Rush Distance:" + rushDistance); //print("Hit Distance:" + hit.distance); StartCoroutine(RollForward(hit.distance, moveSpeed * 2)); } else { StartCoroutine(RollForward(rushDistance, moveSpeed * 2)); } }
//释放技能 public void Release() { ShowSkills(); StartCoroutine(EndRelease(dragDir)); if (entered) { onAttack.Invoke(); entered = false; } else { switch (dragDir) { case 1: if (skill3.skillIndex > 0) { skill3.RealeaseSkill(); skill3.ResetCD(); } //StartCoroutine(EndRelease(upButton)); break; case 2: if (skill4.skillIndex > 0) { skill4.RealeaseSkill(); skill4.ResetCD(); } //StartCoroutine(EndRelease(downButton)); break; case 3: if (skill5.skillIndex > 0) { skill5.RealeaseSkill(); skill5.ResetCD(); } //StartCoroutine(EndRelease(leftButton)); break; } } }