update Input new in script
This commit is contained in:
33
.idea/.idea.HALLUCINATE/.idea/workspace.xml
generated
33
.idea/.idea.HALLUCINATE/.idea/workspace.xml
generated
@@ -6,27 +6,11 @@
|
|||||||
<component name="ChangeListManager">
|
<component name="ChangeListManager">
|
||||||
<list default="true" id="f9183c68-daf0-43b8-be4c-fad79983f91b" name="Changes" comment="">
|
<list default="true" id="f9183c68-daf0-43b8-be4c-fad79983f91b" name="Changes" comment="">
|
||||||
<change beforePath="$PROJECT_DIR$/.idea/.idea.HALLUCINATE/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HALLUCINATE/.idea/workspace.xml" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/.idea/.idea.HALLUCINATE/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/.idea.HALLUCINATE/.idea/workspace.xml" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Animation/Idle.fbx.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Animation/Idle.fbx.meta" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/CharacterController/vThirdPersonInput.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Invector-3rdPersonController/Basic Locomotion/Scripts/CharacterController/vThirdPersonInput.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Animation/PLayer.controller" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Animation/PLayer.controller" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Invector-3rdPersonController/Melee Combat/Scripts/CharacterController/vMeleeCombatInput.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Invector-3rdPersonController/Melee Combat/Scripts/CharacterController/vMeleeCombatInput.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Animation/Standard Walk.fbx.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Animation/Standard Walk.fbx.meta" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Invector-3rdPersonController/Shooter/Scripts/Shooter/vShooterMeleeInput.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Invector-3rdPersonController/Shooter/Scripts/Shooter/vShooterMeleeInput.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Models/HumanM_Model.fbx.meta" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Models/HumanM_Model.fbx.meta" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/EnvironmentScanner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/EnvironmentScanner.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Network/BasicSpawner.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Network/BasicSpawner.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Network/PlayerInputData.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Network/PlayerInputData.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/InputReader.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/InputReader.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/InputReader.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/InputReader.cs" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerAnimationHandler.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerAnimationHandler.cs" afterDir="false" />
|
<change beforePath="$PROJECT_DIR$/ProjectSettings/Packages/com.unity.probuilder/Settings.json" beforeDir="false" afterPath="$PROJECT_DIR$/ProjectSettings/Packages/com.unity.probuilder/Settings.json" afterDir="false" />
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerDashState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerDashState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerDodgeState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerDodgeState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerFallState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerFallState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerIdleState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerIdleState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerJumpState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerJumpState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerMoveState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerMoveState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerMovement.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerMovement.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerParkourState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerParkourState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerRunState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerRunState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerStateMachine.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerStateMachine.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerThrustState.cs" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/Scripts/Player Controller/PlayerThrustState.cs" afterDir="false" />
|
|
||||||
<change beforePath="$PROJECT_DIR$/Assets/TEST CUA TUAN/DEMO MAP.unity" beforeDir="false" afterPath="$PROJECT_DIR$/Assets/TEST CUA TUAN/DEMO MAP.unity" afterDir="false" />
|
|
||||||
</list>
|
</list>
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
<option name="SHOW_DIALOG" value="false" />
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
||||||
@@ -55,6 +39,9 @@
|
|||||||
<urls />
|
<urls />
|
||||||
</component>
|
</component>
|
||||||
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
|
<component name="MetaFilesCheckinStateConfiguration" checkMetaFiles="true" />
|
||||||
|
<component name="ProblemsViewState">
|
||||||
|
<option name="selectedTabId" value="CurrentFile" />
|
||||||
|
</component>
|
||||||
<component name="ProjectColorInfo">{
|
<component name="ProjectColorInfo">{
|
||||||
"associatedIndex": 4
|
"associatedIndex": 4
|
||||||
}</component>
|
}</component>
|
||||||
@@ -79,7 +66,7 @@
|
|||||||
"node.js.selected.package.eslint": "(autodetect)",
|
"node.js.selected.package.eslint": "(autodetect)",
|
||||||
"node.js.selected.package.tslint": "(autodetect)",
|
"node.js.selected.package.tslint": "(autodetect)",
|
||||||
"nodejs_package_manager_path": "npm",
|
"nodejs_package_manager_path": "npm",
|
||||||
"settings.editor.selected.configurable": "preferences.pluginManager",
|
"settings.editor.selected.configurable": "editor.preferences.completion",
|
||||||
"to.speed.mode.migration.done": "true",
|
"to.speed.mode.migration.done": "true",
|
||||||
"vue.rearranger.settings.migration": "true"
|
"vue.rearranger.settings.migration": "true"
|
||||||
}
|
}
|
||||||
@@ -185,6 +172,10 @@
|
|||||||
<workItem from="1779293096539" duration="3004000" />
|
<workItem from="1779293096539" duration="3004000" />
|
||||||
<workItem from="1779962085481" duration="671000" />
|
<workItem from="1779962085481" duration="671000" />
|
||||||
<workItem from="1780000221080" duration="1566000" />
|
<workItem from="1780000221080" duration="1566000" />
|
||||||
|
<workItem from="1780139911301" duration="1008000" />
|
||||||
|
<workItem from="1780140952531" duration="441000" />
|
||||||
|
<workItem from="1780141455151" duration="159000" />
|
||||||
|
<workItem from="1780141729457" duration="9450000" />
|
||||||
</task>
|
</task>
|
||||||
<servers />
|
<servers />
|
||||||
</component>
|
</component>
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
using System.Collections;
|
using System.Collections;
|
||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using UnityEngine.Events;
|
using UnityEngine.Events;
|
||||||
|
using UnityEngine.InputSystem;
|
||||||
|
|
||||||
namespace Invector.vCharacterController
|
namespace Invector.vCharacterController
|
||||||
{
|
{
|
||||||
@@ -23,13 +24,19 @@ namespace Invector.vCharacterController
|
|||||||
public KeyCode toggleWalk = KeyCode.CapsLock;
|
public KeyCode toggleWalk = KeyCode.CapsLock;
|
||||||
|
|
||||||
[Header("Movement Input")]
|
[Header("Movement Input")]
|
||||||
public GenericInput horizontalInput = new GenericInput("Horizontal", "LeftAnalogHorizontal", "Horizontal");
|
|
||||||
public GenericInput verticalInput = new GenericInput("Vertical", "LeftAnalogVertical", "Vertical");
|
|
||||||
public GenericInput sprintInput = new GenericInput("LeftShift", "LeftStickClick", "LeftStickClick");
|
|
||||||
public GenericInput crouchInput = new GenericInput("C", "Y", "Y");
|
// public GenericInput horizontalInput = new GenericInput("Horizontal", "LeftAnalogHorizontal", "Horizontal");
|
||||||
public GenericInput strafeInput = new GenericInput("Tab", "RightStickClick", "RightStickClick");
|
// public GenericInput verticalInput = new GenericInput("Vertical", "LeftAnalogVertical", "Vertical");
|
||||||
public GenericInput jumpInput = new GenericInput("Space", "X", "X");
|
// public GenericInput sprintInput = new GenericInput("LeftShift", "LeftStickClick", "LeftStickClick");
|
||||||
public GenericInput rollInput = new GenericInput("Q", "B", "B");
|
// public GenericInput crouchInput = new GenericInput("C", "Y", "Y");
|
||||||
|
// public GenericInput strafeInput = new GenericInput("Tab", "RightStickClick", "RightStickClick");
|
||||||
|
// public GenericInput jumpInput = new GenericInput("Space", "X", "X");
|
||||||
|
// public GenericInput rollInput = new GenericInput("Q", "B", "B");
|
||||||
|
|
||||||
|
[Header("New Input System")]
|
||||||
|
public OnlyScove.Scripts.InputReader inputReader;
|
||||||
|
|
||||||
protected bool _lockInput = false;
|
protected bool _lockInput = false;
|
||||||
[HideInInspector] public virtual bool lockInput { get { return _lockInput; } set { _lockInput = value; } }
|
[HideInInspector] public virtual bool lockInput { get { return _lockInput; } set { _lockInput = value; } }
|
||||||
@@ -37,11 +44,11 @@ namespace Invector.vCharacterController
|
|||||||
[vEditorToolbar("Camera Settings")]
|
[vEditorToolbar("Camera Settings")]
|
||||||
public bool lockCameraInput;
|
public bool lockCameraInput;
|
||||||
public bool invertCameraInputVertical, invertCameraInputHorizontal;
|
public bool invertCameraInputVertical, invertCameraInputHorizontal;
|
||||||
[vEditorToolbar("Inputs")]
|
// [vEditorToolbar("Inputs")]
|
||||||
[Header("Camera Input")]
|
[Header("Camera Input")]
|
||||||
public GenericInput rotateCameraXInput = new GenericInput("Mouse X", "RightAnalogHorizontal", "Mouse X");
|
// public GenericInput rotateCameraXInput = new GenericInput("Mouse X", "RightAnalogHorizontal", "Mouse X");
|
||||||
public GenericInput rotateCameraYInput = new GenericInput("Mouse Y", "RightAnalogVertical", "Mouse Y");
|
// public GenericInput rotateCameraYInput = new GenericInput("Mouse Y", "RightAnalogVertical", "Mouse Y");
|
||||||
public GenericInput cameraZoomInput = new GenericInput("Mouse ScrollWheel", "", "");
|
// public GenericInput cameraZoomInput = new GenericInput("Mouse ScrollWheel", "", "");
|
||||||
|
|
||||||
[vEditorToolbar("Events")]
|
[vEditorToolbar("Events")]
|
||||||
public UnityEvent OnLockCamera;
|
public UnityEvent OnLockCamera;
|
||||||
@@ -136,6 +143,33 @@ namespace Invector.vCharacterController
|
|||||||
ShowCursor(showCursorOnStart);
|
ShowCursor(showCursorOnStart);
|
||||||
LockCursor(unlockCursorOnStart);
|
LockCursor(unlockCursorOnStart);
|
||||||
EnableOnAnimatorMove();
|
EnableOnAnimatorMove();
|
||||||
|
if (inputReader != null)
|
||||||
|
{
|
||||||
|
// Nhảy (Jump)
|
||||||
|
inputReader.OnJumpEvent += () =>
|
||||||
|
{
|
||||||
|
if (JumpConditions()) cc.Jump(true);
|
||||||
|
};
|
||||||
|
|
||||||
|
// Lộn vòng (Roll / Dodge)
|
||||||
|
inputReader.OnDodgeEvent += () =>
|
||||||
|
{
|
||||||
|
if (RollConditions()) cc.Roll();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Ngồi (Crouch)
|
||||||
|
inputReader.OnCrouchEvent += () =>
|
||||||
|
{
|
||||||
|
cc.AutoCrouch();
|
||||||
|
cc.Crouch();
|
||||||
|
};
|
||||||
|
|
||||||
|
// Đổi góc nhìn hoặc Khóa mục tiêu (Strafe) - Tuỳ bạn map nút nào vào OnToggleViewEvent
|
||||||
|
inputReader.OnToggleViewEvent += () =>
|
||||||
|
{
|
||||||
|
cc.Strafe();
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual IEnumerator CharacterInit()
|
protected virtual IEnumerator CharacterInit()
|
||||||
@@ -448,19 +482,26 @@ namespace Invector.vCharacterController
|
|||||||
|
|
||||||
public virtual void MoveInput()
|
public virtual void MoveInput()
|
||||||
{
|
{
|
||||||
|
if (inputReader == null) return;
|
||||||
if (!lockMoveInput)
|
if (!lockMoveInput)
|
||||||
{
|
{
|
||||||
// gets input
|
// gets input
|
||||||
var input = cc.input;
|
var input = cc.input;
|
||||||
input.x = horizontalInput.GetAxisRaw();
|
// input.x = horizontalInput.GetAxisRaw();
|
||||||
input.z = verticalInput.GetAxisRaw();
|
// input.z = verticalInput.GetAxisRaw();
|
||||||
|
// Input.GetAxisRaw("Horizontal");
|
||||||
|
// Input.GetAxisRaw("Vertical");
|
||||||
|
|
||||||
|
input.x = inputReader.MoveInput.x;
|
||||||
|
input.z = inputReader.MoveInput.y;
|
||||||
cc.input = input;
|
cc.input = input;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Input.GetKeyDown(toggleWalk))
|
//if (Input.GetKeyDown(toggleWalk))
|
||||||
{
|
//{
|
||||||
cc.alwaysWalkByDefault = !cc.alwaysWalkByDefault;
|
//cc.alwaysWalkByDefault = !cc.alwaysWalkByDefault;
|
||||||
}
|
//}
|
||||||
|
Input.GetKeyDown(KeyCode.CapsLock);
|
||||||
|
|
||||||
cc.ControlKeepDirection();
|
cc.ControlKeepDirection();
|
||||||
}
|
}
|
||||||
@@ -488,28 +529,30 @@ namespace Invector.vCharacterController
|
|||||||
|
|
||||||
public virtual void StrafeInput()
|
public virtual void StrafeInput()
|
||||||
{
|
{
|
||||||
if (strafeInput.GetButtonDown())
|
// if (strafeInput.GetButtonDown())
|
||||||
{
|
// {
|
||||||
cc.Strafe();
|
// cc.Strafe();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void SprintInput()
|
public virtual void SprintInput()
|
||||||
{
|
{
|
||||||
if (sprintInput.useInput)
|
// if (sprintInput.useInput)
|
||||||
{
|
// {
|
||||||
cc.Sprint(cc.useContinuousSprint ? sprintInput.GetButtonDown() : sprintInput.GetButton());
|
// cc.Sprint(cc.useContinuousSprint ? sprintInput.GetButtonDown() : sprintInput.GetButton());
|
||||||
}
|
// }
|
||||||
|
if (inputReader == null) return;
|
||||||
|
cc.Sprint(inputReader.IsSprintHeld);
|
||||||
}
|
}
|
||||||
|
|
||||||
public virtual void CrouchInput()
|
public virtual void CrouchInput()
|
||||||
{
|
{
|
||||||
cc.AutoCrouch();
|
cc.AutoCrouch();
|
||||||
|
|
||||||
if (crouchInput.useInput && crouchInput.GetButtonDown())
|
// if (crouchInput.useInput && crouchInput.GetButtonDown())
|
||||||
{
|
// {
|
||||||
cc.Crouch();
|
// cc.Crouch();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -526,10 +569,10 @@ namespace Invector.vCharacterController
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void JumpInput()
|
public virtual void JumpInput()
|
||||||
{
|
{
|
||||||
if (jumpInput.GetButtonDown() && JumpConditions())
|
// if (jumpInput.GetButtonDown() && JumpConditions())
|
||||||
{
|
// {
|
||||||
cc.Jump(true);
|
// cc.Jump(true);
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -546,10 +589,10 @@ namespace Invector.vCharacterController
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public virtual void RollInput()
|
public virtual void RollInput()
|
||||||
{
|
{
|
||||||
if (rollInput.GetButtonDown() && RollConditions())
|
// if (rollInput.GetButtonDown() && RollConditions())
|
||||||
{
|
// {
|
||||||
cc.Roll();
|
// cc.Roll();
|
||||||
}
|
// }
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -567,20 +610,19 @@ namespace Invector.vCharacterController
|
|||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
if (!cameraMain || tpCamera == null || inputReader == null) return;
|
||||||
|
|
||||||
var Y = lockCameraInput ? 0f : rotateCameraYInput.GetAxis();
|
// var Y = lockCameraInput ? 0f : rotateCameraYInput.GetAxis();
|
||||||
var X = lockCameraInput ? 0f : rotateCameraXInput.GetAxis();
|
// var X = lockCameraInput ? 0f : rotateCameraXInput.GetAxis();
|
||||||
if (invertCameraInputHorizontal)
|
|
||||||
{
|
var Y = lockCameraInput ? 0f : inputReader.LookInput.y;
|
||||||
X *= -1;
|
var X = lockCameraInput ? 0f : inputReader.LookInput.x;
|
||||||
}
|
|
||||||
|
if (invertCameraInputHorizontal) X *= -1;
|
||||||
if (invertCameraInputVertical)
|
if (invertCameraInputVertical) Y *= -1;
|
||||||
{
|
|
||||||
Y *= -1;
|
// var zoom = cameraZoomInput.GetAxis();
|
||||||
}
|
var zoom = inputReader.ScrollInput.y;
|
||||||
|
|
||||||
var zoom = cameraZoomInput.GetAxis();
|
|
||||||
|
|
||||||
tpCamera.RotateCamera(X, Y);
|
tpCamera.RotateCamera(X, Y);
|
||||||
if (!lockCameraInput)
|
if (!lockCameraInput)
|
||||||
|
|||||||
@@ -58,6 +58,11 @@ namespace Invector.vCharacterController
|
|||||||
protected override void Start()
|
protected override void Start()
|
||||||
{
|
{
|
||||||
base.Start();
|
base.Start();
|
||||||
|
if (inputReader != null)
|
||||||
|
{
|
||||||
|
inputReader.OnAttackEvent += TriggerWeakAttack;
|
||||||
|
inputReader.OnStrongAttackEvent += TriggerStrongAttack;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LateUpdate()
|
protected override void LateUpdate()
|
||||||
@@ -82,9 +87,9 @@ namespace Invector.vCharacterController
|
|||||||
|
|
||||||
if (MeleeAttackConditions() && !lockMeleeInput)
|
if (MeleeAttackConditions() && !lockMeleeInput)
|
||||||
{
|
{
|
||||||
MeleeWeakAttackInput();
|
// MeleeWeakAttackInput();
|
||||||
MeleeStrongAttackInput();
|
// MeleeStrongAttackInput();
|
||||||
BlockingInput();
|
// BlockingInput();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -149,7 +154,8 @@ namespace Invector.vCharacterController
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
isBlocking = blockInput.GetButton() && cc.currentStamina > 0 && !cc.customAction && !isAttacking;
|
// isBlocking = blockInput.GetButton() && cc.currentStamina > 0 && !cc.customAction && !isAttacking;
|
||||||
|
isBlocking = inputReader.IsBlockHeld && cc.currentStamina > 0 && !cc.customAction && !isAttacking;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -157,11 +163,13 @@ namespace Invector.vCharacterController
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public override void SprintInput()
|
public override void SprintInput()
|
||||||
{
|
{
|
||||||
if (sprintInput.useInput)
|
// if (sprintInput.useInput)
|
||||||
{
|
// {
|
||||||
bool canSprint = cc.useContinuousSprint ? sprintInput.GetButtonDown() : sprintInput.GetButton();
|
// bool canSprint = cc.useContinuousSprint ? sprintInput.GetButtonDown() : sprintInput.GetButton();
|
||||||
cc.Sprint(canSprint && !isAttacking);
|
// cc.Sprint(canSprint && !isAttacking);
|
||||||
}
|
//}
|
||||||
|
if(inputReader == null) return;
|
||||||
|
cc.Sprint(inputReader.IsSprintHeld && !isAttacking);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|||||||
@@ -357,6 +357,14 @@ namespace Invector.vCharacterController
|
|||||||
}
|
}
|
||||||
muzzlePosition = Vector3.forward * cc._capsuleCollider.radius * 2;
|
muzzlePosition = Vector3.forward * cc._capsuleCollider.radius * 2;
|
||||||
muzzleForward = Vector3.forward;
|
muzzleForward = Vector3.forward;
|
||||||
|
if (inputReader != null)
|
||||||
|
{
|
||||||
|
inputReader.OnReloadEvent += () =>
|
||||||
|
{
|
||||||
|
if (!isReloading) shooterManager.ReloadWeapon();
|
||||||
|
};
|
||||||
|
inputReader.OnSwitchSideEvent += SwitchCameraSide;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -379,7 +387,7 @@ namespace Invector.vCharacterController
|
|||||||
// We change the Melee Attack Input for the Shooter because 'Mouse1' is the same input to Shot a Fire Weapon
|
// We change the Melee Attack Input for the Shooter because 'Mouse1' is the same input to Shot a Fire Weapon
|
||||||
weakAttackInput = new GenericInput("Mouse2", "RB", "RB");
|
weakAttackInput = new GenericInput("Mouse2", "RB", "RB");
|
||||||
// By default it's disable because it uses the same input as the switchCameraSideInput
|
// By default it's disable because it uses the same input as the switchCameraSideInput
|
||||||
strafeInput.useInput = false;
|
// strafeInput.useInput = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -666,7 +674,11 @@ namespace Invector.vCharacterController
|
|||||||
}
|
}
|
||||||
|
|
||||||
// reset the aimTimming if you sprint while still aiming through the hipfire
|
// reset the aimTimming if you sprint while still aiming through the hipfire
|
||||||
if (sprintInput.GetButtonDown() && _aimTiming > 0f)
|
// if (sprintInput.GetButtonDown() && _aimTiming > 0f)
|
||||||
|
// {
|
||||||
|
// _aimTiming = 0f;
|
||||||
|
// }
|
||||||
|
if(inputReader.IsSprintHeld && _aimTiming > 0f)
|
||||||
{
|
{
|
||||||
_aimTiming = 0f;
|
_aimTiming = 0f;
|
||||||
}
|
}
|
||||||
@@ -692,8 +704,7 @@ namespace Invector.vCharacterController
|
|||||||
|
|
||||||
if (!cc.isRolling)
|
if (!cc.isRolling)
|
||||||
{
|
{
|
||||||
isAimingByInput = (!isReloading || shooterManager.keepAimingWhenReload) && (aimInput.GetButton() || (shooterManager.alwaysAiming && CurrentActiveWeapon)) && !cc.ragdolled && !cc.customAction
|
isAimingByInput = (!isReloading || shooterManager.keepAimingWhenReload) && (inputReader.IsAimHeld || (shooterManager.alwaysAiming && CurrentActiveWeapon)) && !cc.ragdolled && !cc.customAction;
|
||||||
|| (cc.customAction && cc.isJumping);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aimInput.GetButtonUp() && !shotInput.GetButton())
|
if (aimInput.GetButtonUp() && !shotInput.GetButton())
|
||||||
@@ -774,7 +785,8 @@ namespace Invector.vCharacterController
|
|||||||
{
|
{
|
||||||
if (CurrentActiveWeapon || (shooterManager.CurrentWeapon && shooterManager.hipfireShot))
|
if (CurrentActiveWeapon || (shooterManager.CurrentWeapon && shooterManager.hipfireShot))
|
||||||
{
|
{
|
||||||
HandleShotCount(shooterManager.CurrentWeapon, shotInput.GetButton());
|
// HandleShotCount(shooterManager.CurrentWeapon, shotInput.GetButton());
|
||||||
|
HandleShotCount(shooterManager.CurrentWeapon, inputReader.IsAttackHeld);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (!IsAiming)
|
else if (!IsAiming)
|
||||||
|
|||||||
@@ -60,6 +60,10 @@ namespace OnlyScove.Scripts
|
|||||||
public virtual Vector2 ScrollInput { get; protected set; }
|
public virtual Vector2 ScrollInput { get; protected set; }
|
||||||
public virtual bool IsSprintHeld { get; protected set; }
|
public virtual bool IsSprintHeld { get; protected set; }
|
||||||
public virtual bool IsAttackHeld { get; protected set; }
|
public virtual bool IsAttackHeld { get; protected set; }
|
||||||
|
|
||||||
|
|
||||||
|
public bool IsAimHeld { get; protected set; }
|
||||||
|
public bool IsBlockHeld { get; protected set; }
|
||||||
|
|
||||||
public void ApplyNetworkInput(Vector2 move, bool isSprint)
|
public void ApplyNetworkInput(Vector2 move, bool isSprint)
|
||||||
{
|
{
|
||||||
@@ -77,6 +81,10 @@ namespace OnlyScove.Scripts
|
|||||||
public event Action OnNextInteractEvent;
|
public event Action OnNextInteractEvent;
|
||||||
public event Action OnPreviousInteractEvent;
|
public event Action OnPreviousInteractEvent;
|
||||||
public event Action OnToggleViewEvent;
|
public event Action OnToggleViewEvent;
|
||||||
|
|
||||||
|
public event Action OnReloadEvent;
|
||||||
|
public event Action OnStrongAttackEvent;
|
||||||
|
public event Action OnSwitchSideEvent;
|
||||||
|
|
||||||
// UI Events
|
// UI Events
|
||||||
public event Action OnToggleSettingsEvent; // Cho Ctrl+O
|
public event Action OnToggleSettingsEvent; // Cho Ctrl+O
|
||||||
@@ -185,5 +193,30 @@ namespace OnlyScove.Scripts
|
|||||||
OnCancelEvent?.Invoke();
|
OnCancelEvent?.Invoke();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public void OnAim(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed) IsAimHeld = true;
|
||||||
|
if (context.canceled) IsAimHeld = false;
|
||||||
|
}
|
||||||
|
public void OnBlock(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed) IsBlockHeld = true;
|
||||||
|
if (context.canceled) IsBlockHeld = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnStrongAttack(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if(context.performed) OnStrongAttackEvent?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnReload(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed) OnReloadEvent?.Invoke();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void OnSwitchSide(InputAction.CallbackContext context)
|
||||||
|
{
|
||||||
|
if (context.performed) OnSwitchSideEvent?.Invoke();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user