bool inTouch = false; // 是否在触摸事件中 public void Reset() { firstType = AttackFirstType.none; //preFirstType = AttackFirstType.none; touchStartTime = -1; isHold = false; inTouch = false; }
void FirstInstructFunc(AttackFirstType type) { if (type != AttackFirstType.none) { //preFirstType = firstType; firstType = type; DealAttackType(); } }
//AttackSdType preAttackType = AttackSdType.none; //AttackFirstType preFirstType = AttackFirstType.none; //AttackSecondType preSecondType = AttackSecondType.none; public void Reset() { attackType = AttackSdType.none; firstType = AttackFirstType.none; secondType = AttackSecondType.none; //preAttackType = AttackSdType.none; //preFirstType = AttackFirstType.none; //preSecondType = AttackSecondType.none; }
public void Update() { if (!inTouch) { return; } // 检测是否是Hold if (isHold == false && Time.time - touchStartTime >= minHoldTime) { isHold = true; firstType = AttackFirstType.HA1; Notify(); } }
public void OnTouchEnd() { inTouch = false; AttackFirstType tmpType = AttackFirstType.none; switch (firstType) { case AttackFirstType.A1: tmpType = AttackFirstType.AR1; Notify(); break; case AttackFirstType.HA1: tmpType = AttackFirstType.HAR1; break; } SetFirstType(tmpType); Notify(); Reset(); }
public void SetFirstType(AttackFirstType type) { //preFirstType = firstType; firstType = type; }
AttackSdType GetAttackTypeByFirstAndSecond(AttackFirstType firstType, AttackSecondType secondType) { AttackSdType attackType = AttackSdType.none; switch (firstType) { case AttackFirstType.A1: switch (secondType) { case AttackSecondType.N2: attackType = AttackSdType.A; break; case AttackSecondType.U2: attackType = AttackSdType.AU; break; case AttackSecondType.D2: attackType = AttackSdType.AD; break; case AttackSecondType.L2: attackType = AttackSdType.AL; break; case AttackSecondType.R2: attackType = AttackSdType.AR; break; } break; case AttackFirstType.HA1: switch (secondType) { case AttackSecondType.N2: attackType = AttackSdType.HA; break; case AttackSecondType.U2: attackType = AttackSdType.HAU; break; case AttackSecondType.D2: attackType = AttackSdType.HAD; break; case AttackSecondType.L2: attackType = AttackSdType.HAL; break; case AttackSecondType.R2: attackType = AttackSdType.HAR; break; } break; case AttackFirstType.AR1: switch (secondType) { case AttackSecondType.NR2: attackType = AttackSdType.ARN; break; case AttackSecondType.UR2: attackType = AttackSdType.ARU; break; case AttackSecondType.DR2: attackType = AttackSdType.ARD; break; case AttackSecondType.LR2: attackType = AttackSdType.ARL; break; case AttackSecondType.RR2: attackType = AttackSdType.ARR; break; } break; case AttackFirstType.HAR1: switch (secondType) { case AttackSecondType.NR2: attackType = AttackSdType.HARN; break; case AttackSecondType.UR2: attackType = AttackSdType.HARU; break; case AttackSecondType.DR2: attackType = AttackSdType.HARD; break; case AttackSecondType.LR2: attackType = AttackSdType.HARL; break; case AttackSecondType.RR2: attackType = AttackSdType.HARR; break; } break; } return(attackType); }