/// <summary> /// Process the user input. /// </summary> private void ProcessInput() { if (!mAction) { if (JCS_Input.GetMouseByAction(mKeyAct, mMouseButton)) { mAction = true; } if (JCS_Input.GetKey(mShootKeyCode)) { mAction = true; } } if (mAfterDelay) { mActionTimer += Time.deltaTime; if (mTimeDelayAfterShoot < mActionTimer) { // reset timer mActionTimer = 0; // can do the next shoot mAction = false; // exit delay process mAfterDelay = false; } } if (mAction && !mAfterDelay) { mActionTimer += Time.deltaTime; if (mTimeBeforeShoot < mActionTimer) { // do call back mShootCallback.Invoke(); // check able to shoot before shoot. if (mCheckAbleToShoot.Invoke()) { // Do shooting effect for (int count = 0; count < mShootCount; ++count) { Shoot(); } } // start after delay timer. mAfterDelay = true; // reset timer for "mAfterDelay" Trigger. mActionTimer = 0; } } }