This commit is contained in:
2026-06-04 12:42:00 +07:00
parent 5526341041
commit f70082a350
14 changed files with 697 additions and 447 deletions

View File

@@ -12,12 +12,6 @@ namespace Invector.vCharacterController
{
#region Variables
[vEditorToolbar("Inputs")]
[Header("Melee Inputs")]
public GenericInput weakAttackInput = new GenericInput("Mouse0", "RB", "RB");
public GenericInput strongAttackInput = new GenericInput("Alpha1", false, "RT", true, "RT", false);
public GenericInput blockInput = new GenericInput("Mouse1", "LB", "LB");
internal vMeleeManager meleeManager;
protected virtual bool _isAttacking { get; set; }
public virtual bool isAttacking { get => _isAttacking || cc.IsAnimatorTag("Attack"); protected set { _isAttacking = value; } }
@@ -58,11 +52,6 @@ namespace Invector.vCharacterController
protected override void Start()
{
base.Start();
if (inputReader != null)
{
inputReader.OnAttackEvent += TriggerWeakAttack;
inputReader.OnStrongAttackEvent += TriggerStrongAttack;
}
}
protected override void LateUpdate()
@@ -87,9 +76,9 @@ namespace Invector.vCharacterController
if (MeleeAttackConditions() && !lockMeleeInput)
{
// MeleeWeakAttackInput();
// MeleeStrongAttackInput();
// BlockingInput();
MeleeWeakAttackInput();
MeleeStrongAttackInput();
BlockingInput();
}
else
{
@@ -105,12 +94,12 @@ namespace Invector.vCharacterController
/// </summary>
public virtual void MeleeWeakAttackInput()
{
if (animator == null)
if (animator == null || inputReader == null)
{
return;
}
if (weakAttackInput.GetButtonDown() && MeleeAttackStaminaConditions())
if (inputReader.ConsumeAttack() && MeleeAttackStaminaConditions())
{
TriggerWeakAttack();
}
@@ -127,12 +116,12 @@ namespace Invector.vCharacterController
/// </summary>
public virtual void MeleeStrongAttackInput()
{
if (animator == null)
if (animator == null || inputReader == null)
{
return;
}
if (strongAttackInput.GetButtonDown() && (!meleeManager.CurrentActiveAttackWeapon || meleeManager.CurrentActiveAttackWeapon.useStrongAttack) && MeleeAttackStaminaConditions())
if (inputReader.ConsumeStrongAttack() && (!meleeManager.CurrentActiveAttackWeapon || meleeManager.CurrentActiveAttackWeapon.useStrongAttack) && MeleeAttackStaminaConditions())
{
TriggerStrongAttack();
}