//----------------------
        // 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();
                    }
                }
            }
        }
예제 #3
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;
                }
            }
        }