IEnumerator attackFunction() { if (!attackCDLock) { attackCDLock = true; if (attackGO != null) { StartCoroutine("spawnAttackSensorFunction"); //velocityPart Rigidbody2D rigid2d = GetComponentInParent <Rigidbody2D>(); rigid2d.velocity -= new Vector2(4.0f * rigid2d.transform.localScale.x, 0); //rigid2d.transform.position += transform.right * Time.deltaTime * 100; } else { gunspawn.Shot(); } } yield return(new WaitForSeconds(CD)); attackCDLock = false; }
void attackFunction() { if (ComboCounter >= 2) { attackCDLock = true; //鎖上不讓再打 } else if (ComboCounter == 1) { isCastCombo = true; //單純指出現在需要COMBO 未有任何程式碼需要用到 } if (attackGO != null) { //StartCoroutine("spawnAttackSensorFunction"); ComboCounter++; //計算當前要不要COMBO COMBO到多少? spawnAttackAni(); //播動畫 } else { gunspawn.Shot(); } }
void attackFunction() { if (ComboCounter == 2) { attackCDLock = true; //鎖上不讓再打 /* * if (TestAnimator != null && (TestAnimator.GetCurrentAnimatorStateInfo(0).IsName("side_connect")) && !swordBlur.GetComponentInChildren<Animator>().GetCurrentAnimatorStateInfo(0).IsName("knifedown")) * { // Avoid any reload. * Debug.Log(TestAnimator.GetCurrentAnimatorStateInfo(0).IsName("side_connect")); * swordBlur.GetComponentInChildren<Animator>().SetTrigger("sideTrigger"); * } */ } else if (ComboCounter == 1) { isCastCombo = true; //單純指出現在需要COMBO 未有任何程式碼需要用到 } if (attackGO != null) { //StartCoroutine("spawnAttackSensorFunction"); ComboCounter++; //計算當前要不要COMBO COMBO到多少? spawnAttackAni(); //播動畫 } else { Debug.Log("ddd"); gunspawn.Shot(); StartCoroutine("attackColdDown"); //正常要播完動畫才cd } if (swordBlur != null) { swordBlur.GetComponentInChildren <Animator>().SetInteger("ComboCounter", ComboCounter); //Debug.Log(swordBlur.GetComponentInChildren<Animator>().name); swordBlur.GetComponentInChildren <Animator>().speed = 2.5f; } }