private void SwitchWeapons() { if (rpgCharacterWeaponController != null) { if (rpgCharacterWeaponController.isSwitchingFinished) { if (rpgCharacterInputController.inputSwitchUpDown < -0.1f) { rpgCharacterWeaponController.SwitchWeaponTwoHand(0); } else if (rpgCharacterInputController.inputSwitchUpDown > 0.1f) { rpgCharacterWeaponController.SwitchWeaponTwoHand(1); } if (rpgCharacterInputController.inputSwitchLeftRight < -0.1f) { rpgCharacterWeaponController.SwitchWeaponLeftRight(0); } else if (rpgCharacterInputController.inputSwitchLeftRight > 0.1f) { rpgCharacterWeaponController.SwitchWeaponLeftRight(1); } //Shield. if (rpgCharacterInputController.inputShield) { StartCoroutine(rpgCharacterWeaponController._SwitchWeapon(7)); } if (rpgCharacterInputController.inputRelax) { StartCoroutine(rpgCharacterWeaponController._SwitchWeapon(-1)); } } } //Reset Switching. if (rpgCharacterInputController.inputSwitchLeftRight == 0 && rpgCharacterInputController.inputSwitchUpDown == 0) { if (rpgCharacterWeaponController != null) { rpgCharacterWeaponController.isSwitchingFinished = true; } } }
private void Update() { UpdateAnimationSpeed(); if (rpgCharacterMovementController.rpgCharacterState != RPGCharacterState.Swim && rpgCharacterMovementController.MaintainingGround()) { //Revive. if (rpgCharacterInputController.inputDeath) { if (isDead) { Revive(); } } if (canAction) { Blocking(); if (!isBlocking) { Strafing(); RandomIdle(); DirectionalAiming(); Aiming(); Rolling(); //Hit. if (rpgCharacterInputController.inputLightHit) { GetHit(); } //Death. if (rpgCharacterInputController.inputDeath) { if (!isDead) { Death(); } else { Revive(); } } //Attacks. if (rpgCharacterInputController.inputAttackL) { Attack(1); } if (rpgCharacterInputController.inputAttackR) { Attack(2); } if (rpgCharacterInputController.inputLightHit) { GetHit(); } if (rpgCharacterInputController.inputCastL) { AttackKick(1); } if (rpgCharacterInputController.inputCastL) { StartCoroutine(_BlockBreak()); } if (rpgCharacterInputController.inputCastR) { AttackKick(2); } if (rpgCharacterInputController.inputCastR) { StartCoroutine(_BlockBreak()); } //Switch weapons. if (rpgCharacterWeaponController.isSwitchingFinished) { if (rpgCharacterInputController.inputSwitchUpDown < -0.1f) { rpgCharacterWeaponController.SwitchWeaponTwoHand(0); } else if (rpgCharacterInputController.inputSwitchUpDown > 0.1f) { rpgCharacterWeaponController.SwitchWeaponTwoHand(1); } if (rpgCharacterInputController.inputSwitchLeftRight < -0.1f) { rpgCharacterWeaponController.SwitchWeaponLeftRight(0); } else if (rpgCharacterInputController.inputSwitchLeftRight > 0.1f) { rpgCharacterWeaponController.SwitchWeaponLeftRight(1); } //Shield. if (rpgCharacterInputController.inputShield) { StartCoroutine(rpgCharacterWeaponController._SwitchWeapon(7)); } if (rpgCharacterInputController.inputRelax) { StartCoroutine(rpgCharacterWeaponController._SwitchWeapon(-1)); } } //Reset Switching. if (rpgCharacterInputController.inputSwitchLeftRight == 0 && rpgCharacterInputController.inputSwitchUpDown == 0) { rpgCharacterWeaponController.isSwitchingFinished = true; } //Shooting / Navmesh. if (Input.GetMouseButtonDown(0)) { if (rpgCharacterMovementController.useMeshNav) { RaycastHit hit; if (Physics.Raycast(Camera.main.ScreenPointToRay(Input.mousePosition), out hit, 100)) { rpgCharacterMovementController.navMeshAgent.destination = hit.point; } } else if ((weapon == Weapon.TWOHANDBOW || weapon == Weapon.TWOHANDCROSSBOW || weapon == Weapon.RIFLE) && isAiming) { animator.SetInteger("Action", 1); if (weapon == Weapon.RIFLE && hipShooting == true) { animator.SetInteger("Action", 2); } animator.SetTrigger("AttackTrigger"); } } //Reload. if (Input.GetMouseButtonDown(2)) { animator.SetTrigger("ReloadTrigger"); } //Climbing ladder. if (rpgCharacterMovementController.rpgCharacterState == RPGCharacterState.ClimbLadder && !isClimbing) { if (rpgCharacterInputController.inputVertical > 0.1f) { animator.SetInteger("Action", 1); animator.SetTrigger("ClimbLadderTrigger"); } else if (rpgCharacterInputController.inputVertical < -0.1f) { animator.SetInteger("Action", 2); animator.SetTrigger("ClimbLadderTrigger"); } } if (rpgCharacterMovementController.rpgCharacterState == RPGCharacterState.ClimbLadder && isClimbing) { if (rpgCharacterInputController.inputVertical == 0) { isClimbing = false; } } } } } //Injury toggle. if (Input.GetKeyDown(KeyCode.I)) { if (injured == false) { injured = true; animator.SetBool("Injured", true); } else { injured = false; animator.SetBool("Injured", false); } } //Head look toggle. if (Input.GetKeyDown(KeyCode.L)) { if (headLook == false) { headLook = true; isHeadlook = true; } else { headLook = false; isHeadlook = false; } } //Slow time toggle. if (Input.GetKeyDown(KeyCode.T)) { if (Time.timeScale != 1) { Time.timeScale = 1; } else { Time.timeScale = 0.005f; } } //Pause toggle. if (Input.GetKeyDown(KeyCode.P)) { if (Time.timeScale != 1) { Time.timeScale = 1; } else { Time.timeScale = 0f; } } //Swim up/down toggle. if (rpgCharacterMovementController.rpgCharacterState == RPGCharacterState.Swim && (rpgCharacterInputController.inputStrafe || rpgCharacterInputController.inputStrafe || rpgCharacterInputController.inputTargetBlock > 0.1f)) { animator.SetBool("Strafing", true); } else { animator.SetBool("Strafing", false); } }