update
This commit is contained in:
@@ -8,18 +8,6 @@ namespace Invector.vCharacterController
|
||||
[vClassHeader("SHOOTER/MELEE INPUT", iconName = "inputIcon")]
|
||||
public class vShooterMeleeInput : vMeleeCombatInput, vIShooterIKController, PlayerController.vILockCamera
|
||||
{
|
||||
#region Shooter Inputs
|
||||
|
||||
[vEditorToolbar("Inputs")]
|
||||
[Header("Shooter Inputs")]
|
||||
public GenericInput aimInput = new GenericInput("Mouse1", false, "LT", true, "LT", false);
|
||||
public GenericInput shotInput = new GenericInput("Mouse0", false, "RT", true, "RT", false);
|
||||
public GenericInput reloadInput = new GenericInput("R", "LB", "LB");
|
||||
public GenericInput switchCameraSideInput = new GenericInput("Tab", "RightStickClick", "RightStickClick");
|
||||
public GenericInput scopeViewInput = new GenericInput("Z", "RB", "RB");
|
||||
|
||||
#endregion
|
||||
|
||||
#region Shooter Variables
|
||||
|
||||
[HideInInspector] public vShooterManager shooterManager;
|
||||
@@ -293,7 +281,7 @@ namespace Invector.vCharacterController
|
||||
_aimTiming = 0;
|
||||
return false;
|
||||
}
|
||||
return shooterManager.hipfireShot && (_aimTiming > 0 || (shotInput.GetButton() && shooterManager.CurrentWeapon != null) || (!isAimingByInput && shootCountA > 0));
|
||||
return shooterManager.hipfireShot && (_aimTiming > 0 || (inputReader != null && inputReader.IsAttackHeld && shooterManager.CurrentWeapon != null) || (!isAimingByInput && shootCountA > 0));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -357,15 +345,6 @@ namespace Invector.vCharacterController
|
||||
}
|
||||
muzzlePosition = Vector3.forward * cc._capsuleCollider.radius * 2;
|
||||
muzzleForward = Vector3.forward;
|
||||
if (inputReader != null)
|
||||
{
|
||||
inputReader.OnReloadEvent += () =>
|
||||
{
|
||||
if (!isReloading) shooterManager.ReloadWeapon();
|
||||
};
|
||||
inputReader.OnSwitchSideEvent += SwitchCameraSide;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected override void LateUpdate()
|
||||
@@ -384,10 +363,6 @@ namespace Invector.vCharacterController
|
||||
|
||||
protected virtual void Reset()
|
||||
{
|
||||
// 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");
|
||||
// By default it's disable because it uses the same input as the switchCameraSideInput
|
||||
// strafeInput.useInput = false;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -707,7 +682,7 @@ namespace Invector.vCharacterController
|
||||
isAimingByInput = (!isReloading || shooterManager.keepAimingWhenReload) && (inputReader.IsAimHeld || (shooterManager.alwaysAiming && CurrentActiveWeapon)) && !cc.ragdolled && !cc.customAction;
|
||||
}
|
||||
|
||||
if (aimInput.GetButtonUp() && !shotInput.GetButton())
|
||||
if (inputReader.ConsumeAimReleased() && !inputReader.IsAttackHeld)
|
||||
{
|
||||
_aimTiming = 0f;
|
||||
}
|
||||
@@ -887,7 +862,7 @@ namespace Invector.vCharacterController
|
||||
return;
|
||||
}
|
||||
|
||||
if (reloadInput.GetButtonDown())
|
||||
if (inputReader.ConsumeReload())
|
||||
{
|
||||
shootCountA = 0;
|
||||
_aimTiming = 0f;
|
||||
@@ -903,7 +878,7 @@ namespace Invector.vCharacterController
|
||||
if (IsAiming) shooterManager.ReloadWeapon();
|
||||
break;
|
||||
case vShooterWeapon.AutoReloadStyle.WhenShot:
|
||||
if (shotInput.GetButtonDown()) shooterManager.ReloadWeapon();
|
||||
if (inputReader.ConsumeAttack()) shooterManager.ReloadWeapon();
|
||||
break;
|
||||
case vShooterWeapon.AutoReloadStyle.WhenAmmoAvailable:
|
||||
shooterManager.ReloadWeapon();
|
||||
@@ -919,12 +894,12 @@ namespace Invector.vCharacterController
|
||||
/// </summary>
|
||||
public virtual void SwitchCameraSideInput()
|
||||
{
|
||||
if (tpCamera == null)
|
||||
if (tpCamera == null || inputReader == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
if (switchCameraSideInput.GetButtonDown())
|
||||
if (inputReader.ConsumeSwitchSide())
|
||||
{
|
||||
SwitchCameraSide();
|
||||
}
|
||||
@@ -968,7 +943,7 @@ namespace Invector.vCharacterController
|
||||
return;
|
||||
}
|
||||
|
||||
if (isAimingByInput && aimConditions && (scopeViewInput.GetButtonDown() || CurrentActiveWeapon.onlyUseScopeUIView))
|
||||
if (isAimingByInput && aimConditions && (inputReader.ConsumeScopeView() || CurrentActiveWeapon.onlyUseScopeUIView))
|
||||
{
|
||||
if (controlAimCanvas && CurrentActiveWeapon.scopeTarget)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user