//动画控制函数 private void AnimationControl(float v, float h) { if (chaAnimationCon.IsAttacking() || chaAnimationCon.IsSkill3() || currenthp < 0) { return; } chaAnimationCon.SetAttackSpeed(attackSpeed); chaAnimationCon.SetHorizontal(h); chaAnimationCon.SetVertical(v); if (Input.GetKeyUp(KeyCode.Tab)) { isShowMouse = !isShowMouse; if (!isShowMouse) { cameraTransform.parent.parent.GetComponent <FreeLookCam>().OnLockCursor(); } else { cameraTransform.parent.parent.GetComponent <FreeLookCam>().OnShowCursor(); } } if (isShowMouse) { chaAnimationCon.SetHorizontal(0); chaAnimationCon.SetVertical(0); chaAnimationCon.Move(); return; } BattleUIController battleUIController = BattleUIController.Instance; if (!Input.GetKey(KeyCode.LeftShift)) { chaAnimationCon.Walk(); } else { chaAnimationCon.Run(); } chaAnimationCon.Move(); if (Input.GetKeyUp(KeyCode.Mouse0)) { currentSkillID = 0; chaAnimationCon.SetNormalAttackDir(0); chaAnimationCon.Attack(0); } if (Input.GetKeyUp(KeyCode.Mouse1)) { currentSkillID = 0; chaAnimationCon.SetNormalAttackDir(1); chaAnimationCon.Attack(0); } if (Input.GetKeyUp(KeyCode.Q)) { if ((currentmp - 20) < 0) { return; } if (!battleUIController.UseSkill(1)) { return; } currentmp -= 20; currentSkillID = 1; chaAnimationCon.Attack(1); energyChangeEvent.Invoke(maxmp, currentmp); } if (Input.GetKeyUp(KeyCode.E)) { if ((currentmp - 20) < 0) { return; } if (!battleUIController.UseSkill(2)) { return; } currentmp -= 20; currentSkillID = 2; chaAnimationCon.Attack(2); energyChangeEvent.Invoke(maxmp, currentmp); } if (Input.GetKeyUp(KeyCode.R)) { if ((currentmp - 100) < 0) { return; } if (!battleUIController.UseSkill(3)) { return; } currentmp -= 100; currentSkillID = 3; chaAnimationCon.Attack(3); energyChangeEvent.Invoke(maxmp, currentmp); } if (Input.GetKeyUp(KeyCode.Alpha1)) { if (!battleUIController.UseHPMedication()) { return; } currenthp = ((currenthp + battleUIController.GetAddHp()) > maxhp ? maxhp : (currenthp + battleUIController.GetAddHp())); bloodChangeEvent.Invoke(maxhp, currenthp); if (resumeHPEffect != null) { (Instantiate(resumeHPEffect, transform.position, transform.rotation) as GameObject).transform.SetParent(transform); } } if (Input.GetKeyUp(KeyCode.Alpha2)) { if (!battleUIController.UseMPMedication()) { return; } currentmp = ((currentmp + battleUIController.GetAddMp()) > maxmp ? maxmp : (currentmp + battleUIController.GetAddMp())); energyChangeEvent.Invoke(maxmp, currentmp); if (resumeMPEffect != null) { (Instantiate(resumeMPEffect, transform.position, transform.rotation) as GameObject).transform.SetParent(transform); } } }