//使用技能 private void SkillUse() { int skillid = 0; if (Input.GetMouseButtonDown(0)) { skillid = 10001; } else { return; } skillSystem.AttackUseSkill(skillid); }
private void OnSkillButtonDown() { //正在攻击 ,退出 if (IsAttacking()) { return; } //按住间隔小于2则取消攻击 //间隔小于5秒视为连击 float interval = Time.time - lastPressTime; if (interval < 2) { return; } //连击 bool isBatter = interval <= 5; int id = 100; skillSystem.AttackUseSkill(id, isBatter); lastPressTime = Time.time; }
public void OnSkillButtonDown() { // CharacterSkillManager skillManager = GetComponent<CharacterSkillManager> (); // SkillData data = skillManager.PrepareSkill (1001); // if (data != null) // skillManager.GenerateSkill (data); skillSystem.AttackUseSkill(1001); }
//行为: //void OnEnable() //{ //点击遥感 就执行+=后边的方法 // EasyJoystick.On_JoystickMove += JoystickMove;//委托和事件day5 // EasyJoystick.On_JoystickMoveEnd += JoystickMoveEnd; // EasyButton.On_ButtonDown+=On_ButtonDown; //} //void OnDisable() //{ // EasyJoystick.On_JoystickMove -= JoystickMove;//委托和事件day5 // EasyJoystick.On_JoystickMoveEnd -= JoystickMoveEnd; // EasyButton.On_ButtonDown -= On_ButtonDown; //} /// <summary> /// 摇杆移动执行的方法 /// </summary> //public void JoystickMove(MovingJoystick move) //{ // chMotor.Move(move.joystickAxis.x, move.joystickAxis.y); //} /// <summary> /// 摇杆停止时执行的方法 /// </summary> //public void JoystickMoveEnd(MovingJoystick move) //{ // chMotor.Move(move.joystickAxis.x, move.joystickAxis.y); //} public void On_ButtonDown(string buttonName) { //characterskill.attackuseskill(int.Parse(buttonName.Substring(buttonName.Length-1)), false); switch (buttonName) { case "Skill1": characterSkill.AttackUseSkill(1, false); break; case "Skill2": characterSkill.AttackUseSkill(2, false); break; case "Skill3": characterSkill.AttackUseSkill(3, false); break; } }
private void OnSkillButtonDown() { // CharacterSkillManager SkillManager = GetComponent<CharacterSkillManager>(); // SkillData data = SkillManager.PrepareSkill(1002); // if (data != null) // { // SkillManager.GenerateSkill(data); // } //1.如果正在攻击则退出 if (IsAttacking()) { return; } //2.队列queue int id = 1002; skillSystem.AttackUseSkill(id); }
void Update() { ///控制玩家移动 switch (runningType) { case RunningType.PC: hor = Input.GetAxis("Horizontal"); ver = Input.GetAxis("Vertical"); playerMotor.Move(hor, ver); break; case RunningType.Mobile: print("移动端移动"); break; } //玩家攻击和释放技能 if (Input.GetKeyDown(KeyCode.A)) { chSkillSystem.AttackUseSkill(0); } }