Beispiel #1
0
    void ShotInput()
    {
        if (!shooterManager || shooterManager.rWeapon == null)
        {
            return;
        }
        if (isAiming && !shooterManager.shotting && aimConditions && !isReloading && !isAttacking)
        {
            if (shooterManager.rWeapon.automaticWeapon ? shotInput.GetButton() : shotInput.GetButtonDown())
            {
                shooterManager.Shoot(aimPosition);
            }

            else if (shotInput.GetButtonDown())
            {
                if (allowAttack == false)
                {
                    shooterManager.Shoot(aimPosition);
                    allowAttack = true;
                }
            }
            else
            {
                allowAttack = false;
            }
        }
    }
Beispiel #2
0
        void ExitLadderInput()
        {
            if (!isUsingLadder)
            {
                return;
            }
            if (tpInput.cc.baseLayerInfo.IsName("EnterLadderTop") || tpInput.cc.baseLayerInfo.IsName("EnterLadderBottom"))
            {
                return;
            }

            if (ladderAction == null)
            {
                // exit ladder at any moment by pressing the cancelInput
                if (tpInput.cc.baseLayerInfo.IsName("ClimbLadder") && exitInput.GetButtonDown())
                {
                    if (debugMode)
                    {
                        Debug.Log("Quick Exit");
                    }
                    ResetPlayerSettings();
                }
            }
            else
            {
                var animationClip = ladderAction.exitAnimation;
                if (animationClip == "ExitLadderBottom")
                {
                    // exit ladder when reach the bottom by pressing the cancelInput or pressing down at
                    if (exitInput.GetButtonDown() || (speed <= -0.05f && !triggerExitOnce))
                    {
                        if (debugMode)
                        {
                            Debug.Log("Exit Bottom");
                        }
                        triggerExitOnce = true;
                        tpInput.cc.animator.CrossFadeInFixedTime(ladderAction.exitAnimation, 0.1f);             // trigger the animation clip
                    }
                }
                else if (animationClip == "ExitLadderTop" && tpInput.cc.baseLayerInfo.IsName("ClimbLadder"))    // exit the ladder from the top
                {
                    if ((speed >= 0.05f) && !triggerExitOnce && !tpInput.cc.animator.IsInTransition(0))         // trigger the exit animation by pressing up
                    {
                        if (debugMode)
                        {
                            Debug.Log("Exit Top");
                        }
                        triggerExitOnce = true;
                        tpInput.cc.animator.CrossFadeInFixedTime(ladderAction.exitAnimation, 0.1f);             // trigger the animation clip
                    }
                }
            }
        }
Beispiel #3
0
 void EquipmentInput()
 {
     if (!equipmentDisplayWindow.gameObject.activeSelf && openEquipment.GetButtonDown())
     {
         equipmentDisplayWindow.gameObject.SetActive(true);
         isOpen         = true;
         Time.timeScale = timeScaleWhileIsOpen;
     }
     else if (equipmentDisplayWindow.gameObject.activeSelf && (openEquipment.GetButtonDown() || cancel.GetButtonDown()))
     {
         equipmentDisplayWindow.gameObject.SetActive(false);
         isOpen         = false;
         Time.timeScale = 1;
     }
 }
Beispiel #4
0
    public virtual void CheckInput()
    {
        if (currentBuild && currentBuild.canCreate)
        {
            if (enterBuildMode.GetButtonDown())
            {
                inBuildMode = !inBuildMode;

                if (inBuildMode)
                {
                    EnterBuildMode();
                }
                else
                {
                    ExitBuildMode();
                }
            }
        }
        else if (inBuildMode)
        {
            inBuildMode = false;
            if (currentBuild)
            {
                ExitBuildMode();
            }
        }
    }
Beispiel #5
0
    }//set c buttom to crounch method

    protected virtual void JumpInput()
    {
        if (jumpInput.GetButtonDown())
        {
            cc.Jump(true);
        }
    }// set space button to jump method
Beispiel #6
0
    }// set space button to jump method

    protected virtual void RollInput()
    {
        if (rollInput.GetButtonDown())
        {
            cc.Roll();
        }
    }//set Q button to roll
Beispiel #7
0
 /// <summary>
 /// Input Button to remove the current selected equipped Item
 /// </summary>
 protected virtual void RemoveEquipmentInput()
 {
     if (currentEquipArea != null && removeEquipment.GetButtonDown())
     {
         currentEquipArea.UnequipCurrentItem();
     }
 }
Beispiel #8
0
    protected virtual void LockOnInput()
    {
        if (tpInput.tpCamera == null || tpInput.cc == null)
        {
            return;
        }

        // lock the camera into a target, if there is any around
        if (lockOnInput.GetButtonDown() && !tpInput.cc.actions)
        {
            isLockingOn = !isLockingOn;
            LockOn(isLockingOn);
        }
        // unlock the camera if the target is null
        else if (isLockingOn && (tpInput.tpCamera.lockTarget == null))
        {
            isLockingOn = false;
            LockOn(false);
        }
        // choose to use lock-on with strafe of free movement
        if (strafeWhileLockOn && !tpInput.cc.locomotionType.Equals(vThirdPersonMotor.LocomotionType.OnlyStrafe))
        {
            if (isLockingOn && tpInput.tpCamera.lockTarget != null)
            {
                tpInput.cc.isStrafing = true;
            }
            else
            {
                tpInput.cc.isStrafing = false;
            }
        }
    }
Beispiel #9
0
 /// <summary>
 /// Input Button to remove equiped Item
 /// </summary>
 void RemoveEquipmentInput()
 {
     if (currentEquipArea != null && removeEquipment.GetButtonDown())
     {
         currentEquipArea.RemoveItem();
     }
 }
Beispiel #10
0
    }//set shift buttom to sprint method

    protected virtual void StrafeInput()
    {
        if (strafeInput.GetButtonDown())
        {
            cc.Strafe();
        }
    }//set TAB to strafe
Beispiel #11
0
    }//set TAB to strafe

    protected virtual void CrounchInput()
    {
        if (crouchInput.GetButtonDown())
        {
            cc.Crounch();
        }
    }//set c buttom to crounch method
Beispiel #12
0
 internal void CheckInput(vItem item, UnityEngine.Events.UnityEvent onEquip)
 {
     if (input.GetButtonDown())
     {
         Equip(item);
         onEquip?.Invoke();
     }
 }
Beispiel #13
0
 void InventoryInput()
 {
     if (!firstWindow.gameObject.activeSelf && openInventory.GetButtonDown())
     {
         firstWindow.gameObject.SetActive(true);
         isOpen = true;
         //      onOpenCloseInventory.Invoke(true);
         Time.timeScale = timeScaleWhileIsOpen;
     }
     else if (firstWindow.gameObject.activeSelf && (openInventory.GetButtonDown() || cancel.GetButtonDown()))
     {
         firstWindow.gameObject.SetActive(false);
         isOpen = false;
         //       onOpenCloseInventory.Invoke(false);
         Time.timeScale = 1;
     }
 }
 protected virtual void HandleShot(vShooterWeapon weapon, GenericInput weaponInput, bool secundaryShot = false)
 {
     if (weapon.chargeWeapon)
     {
         if (weapon.ammoCount > 0 && weapon.powerCharge < 1 && weaponInput.GetButton())
         {
             weapon.powerCharge += Time.deltaTime * weapon.chargeSpeed;
         }
         else if ((weapon.powerCharge >= 1 && weapon.autoShotOnFinishCharge) || weaponInput.GetButtonUp() || (!weaponInput.GetButton() && isAiming && weapon.powerCharge > 0))
         {
             if (shooterManager.hipfireShot)
             {
                 aimTimming = 3f;
             }
             shooterManager.Shoot(aimPosition, !isAiming, secundaryShot);
             weapon.powerCharge = 0;
         }
         animator.SetFloat("PowerCharger", weapon.powerCharge);
     }
     else if (weapon.automaticWeapon ? weaponInput.GetButton() : weaponInput.GetButtonDown())
     {
         if (shooterManager.hipfireShot)
         {
             aimTimming = 3f;
         }
         shooterManager.Shoot(aimPosition, !isAiming, secundaryShot);
     }
     else if (weaponInput.GetButtonDown())
     {
         if (allowAttack == false)
         {
             if (shooterManager.hipfireShot)
             {
                 aimTimming = 1f;
             }
             shooterManager.Shoot(aimPosition, !isAiming, secundaryShot);
             allowAttack = true;
         }
     }
     else
     {
         allowAttack = false;
     }
 }
Beispiel #15
0
        protected virtual void TriggerAnimation()
        {
            // condition to trigger the animation
            bool playConditions = !isPlaying && !tpInput.cc.customAction && !string.IsNullOrEmpty(animationClip);

            if (actionInput.GetButtonDown() && playConditions)
            {
                PlayAnimation();
            }
        }
Beispiel #16
0
    }//set values from to playercontroller

    protected virtual void SprintInput()
    {
        if (sprintInput.GetButtonDown())
        {
            cc.Sprint(true);
        }
        else
        {
            cc.Sprint(false);
        }
    }//set shift buttom to sprint method
 protected virtual void ReloadInput()
 {
     if (!shooterManager || shooterManager.rWeapon == null)
     {
         return;
     }
     if (reloadInput.GetButtonDown() && !cc.actions && !cc.ragdolled)
     {
         shooterManager.ReloadWeapon();
     }
 }
Beispiel #18
0
 /// <summary>
 /// Input Button to open the selected equipSlot
 /// </summary>
 void OpenCurrentSlot()
 {
     if (vInput.instance.inputDevice == InputDevice.Mobile)
     {
         if (currentEquipArea != null && openCurrentSlot.GetButtonDown())
         {
             if (currentEquipArea.currentSelectedSlot != null)
                 currentEquipArea.OnSubmitSlot(currentEquipArea.currentSelectedSlot);
         }
     }
 }
Beispiel #19
0
 public void Update()
 {
     if (selectRightInput.GetButtonDown())
     {
         SelectRight();
     }
     else if (selectLeftInput.GetButtonDown())
     {
         SelectLeft();
     }
 }
 protected virtual void SwitchCameraSide()
 {
     if (tpCamera == null)
     {
         return;
     }
     if (switchCameraSideInput.GetButtonDown())
     {
         isCameraRightSwitched = !isCameraRightSwitched;
         tpCamera.SwitchRight(isCameraRightSwitched);
     }
 }
Beispiel #21
0
        void EnterLadderInput()
        {
            if (ladderAction == null || tpInput.cc.customAction || tpInput.cc.isJumping || !tpInput.cc.isGrounded)
            {
                return;
            }

            if (enterInput.GetButtonDown() && !isUsingLadder && !ladderAction.autoAction)
            {
                TriggerEnterLadder();
            }
        }
Beispiel #22
0
        protected virtual void EnterLadderInput()
        {
            if (targetLadderAction == null || tpInput.cc.customAction || tpInput.cc.isJumping || !tpInput.cc.isGrounded || tpInput.cc.isRolling)
            {
                return;
            }

            if (enterInput.GetButtonDown() && !enterLadderStarted && !isUsingLadder && !targetLadderAction.autoAction)
            {
                TriggerEnterLadder();
            }
        }
Beispiel #23
0
    void Update()
    {
        if (input.GetButtonDown() && gameObject.activeSelf)
        {
            if (disableThisObjectAfterInput)
            {
                this.gameObject.SetActive(false);
            }

            OnPressInput.Invoke();
        }
    }
Beispiel #24
0
    }/// WEAK ATK INPUT

    protected virtual void MeleeStrongAttackInput()
    {
        if (cc.anime == null)
        {
            return;
        }

        if (strongAttackInput.GetButtonDown() && MeleeAttackStaminaConditions())
        {
            cc.anime.SetInteger("AttackID", meleeManager.GetAttackID());
            cc.anime.SetTrigger("StrongAttack");
        }
    }/// STRONG ATK INPUT
Beispiel #25
0
 /// <summary>
 /// Input Button to open the selected equipSlot
 /// </summary>
 void OpenCurrentSlot()
 {
     if (Invector.CharacterController.vInput.instance.inputDevice == CharacterController.InputDevice.Mobile)
     {
         if (currentEquipArea != null && openCurrentSlot.GetButtonDown())
         {
             if (currentEquipArea.currentSelectedSlot != null)
             {
                 currentEquipArea.OnSubmitSlot(currentEquipArea.currentSelectedSlot);
             }
         }
     }
 }
Beispiel #26
0
 /// <summary>
 /// Manage the input to open or close the Inventory
 /// </summary>
 public virtual void OpenCloseInventoryInput()
 {
     if (openInventory.GetButtonDown() && canEquip)
     {
         if (!isOpen)
         {
             OpenInventory();
         }
         else
         {
             CloseInventory();
         }
     }
 }
Beispiel #27
0
        protected virtual void ReloadInput()
        {
            var weapon = shooterManager.rWeapon ? shooterManager.rWeapon : shooterManager.lWeapon;

            if (!shooterManager || weapon == null)
            {
                return;
            }
            if (reloadInput.GetButtonDown() && !cc.actions && !cc.ragdolled)
            {
                aimTimming = 0f;
                shooterManager.ReloadWeapon();
            }
        }
Beispiel #28
0
        protected virtual void TriggerAnimation()
        {
            // condition to trigger the animation
            bool playConditions = !isPlaying && !tpInput.cc.customAction && !string.IsNullOrEmpty(animationClip);

            if (actionInput.GetButtonDown() && playConditions)
            {
                // we use a bool to trigger the event just once at the end of the animation
                triggerOnce = true;
                // trigger the OnPlay Event
                OnPlayAnimation.Invoke();
                // trigger the animationClip
                tpInput.cc.animator.CrossFadeInFixedTime(animationClip, 0.1f);
            }
        }
Beispiel #29
0
        protected virtual void Update()
        {
            if (itemWindow && itemWindow.currentSelectedSlot && itemWindow.currentSelectedSlot.item)
            {
                for (int i = 0; i < areasToEquip.Length; i++)
                {
                    areasToEquip[i].CheckInput(itemWindow.currentSelectedSlot.item, onEquip);
                }
            }

            if (cancelInput.GetButtonDown())
            {
                onCancel.Invoke();
            }
        }
    protected virtual void ShotInput()
    {
        if (!shooterManager || shooterManager.rWeapon == null)
        {
            return;
        }

        if ((isAiming && !shooterManager.hipfireShot || shooterManager.hipfireShot) && !shooterManager.isShooting && aimConditions && !isReloading && !isAttacking)
        {
            if (shooterManager.rWeapon.automaticWeapon ? shotInput.GetButton() : shotInput.GetButtonDown())
            {
                if (shooterManager.hipfireShot)
                {
                    aimTimming = 3f;
                }
                shooterManager.Shoot(aimPosition, !isAiming);
            }
            else if (shotInput.GetButtonDown())
            {
                if (allowAttack == false)
                {
                    if (shooterManager.hipfireShot)
                    {
                        aimTimming = 1f;
                    }
                    shooterManager.Shoot(aimPosition, !isAiming);
                    allowAttack = true;
                }
            }
            else
            {
                allowAttack = false;
            }
        }
        shooterManager.UpdateShotTime();
    }