//---------------------- // Protected Functions //---------------------- // Private Functions /// <summary> /// Process/Handle the inputs from the user. /// </summary> private void ProcessInput() { if (JCS_Input.GetMouseByAction(mShootAction.KeyAct, mShootAction.MouseButton) || JCS_Input.GetKeyByAction(mShootAction.KeyAct, mShootAction.ShootKeyCode)) { // check we are able to shoot. // like enough mana to cast? or something like this. if (mShootAction.GetCheckAbleToShootFunction().Invoke()) { // do callback mShootAction.GetShootCallback().Invoke(); ShootsInSequence(); } } }
/// <summary> /// Process/Handle the inputs from the user. /// </summary> private void ProcessInput() { if (JCS_Input.GetMouseByAction(mShootAction.KeyAct, mShootAction.MouseButton) || JCS_Input.GetKeyByAction(mShootAction.KeyAct, mShootAction.ShootKeyCode)) { if (mShootAction.GetCheckAbleToShootFunction().Invoke()) { // do call back mShootAction.GetShootCallback().Invoke(); // shoot a bullet. for (int count = 0; count < mShootAction.ShootCount; ++count) { mShootAction.Shoot(); } } } }
/// <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; } } }
/// <summary> /// Process/Handle the inputs from the user. /// </summary> private void ProcessInput() { if (!mAction) { if (JCS_Input.GetKey(mShootAction.ShootKeyCode) || JCS_Input.GetMouseByAction(mShootAction.KeyAct, mShootAction.MouseButton)) { // find the target switch (mShootAction.GetTrackType()) { case JCS_ShootAction.TrackType.CLOSEST: mDetectedObject = mShootAction.GetDetectAreaAction().FindTheClosest(); break; case JCS_ShootAction.TrackType.FURTHEST: mDetectedObject = mShootAction.GetDetectAreaAction().FindTheFurthest(); break; } 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) { if (mShootAction.GetShootCallback() != null) { // do call back mShootAction.GetShootCallback().Invoke(); } // Do shooting effect Shoots(mHit, this.transform.position); // start after delay timer. mAfterDelay = true; // reset timer for "mAfterDelay" Trigger. mActionTimer = 0; } } }