block improvements, autolock improvements and auto off, block button auto on/off, recoil anim improvement
This commit is contained in:
@@ -12,6 +12,7 @@ namespace Beyond
|
||||
public Button ActionButton;
|
||||
public Button LadderButton;
|
||||
public Button CrouchButton;
|
||||
public Button BlockButton;
|
||||
public GameObject AttackButton;
|
||||
public GameObject SpellButton;
|
||||
public GameObject ComsumableButton;
|
||||
@@ -216,10 +217,12 @@ return left.CompareTo(right) >= 0;
|
||||
if (state == GameStateManager.State.COMBAT)
|
||||
{
|
||||
DashButton.gameObject.SetActive(true);
|
||||
BlockButton.gameObject.SetActive(true);
|
||||
}
|
||||
else if (state == GameStateManager.State.NORMAL)
|
||||
{
|
||||
DashButton.gameObject.SetActive(false);
|
||||
BlockButton.gameObject.SetActive(false);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -189,12 +189,28 @@ namespace Beyond
|
||||
// base.isCharacterAlive() checks the base.currentTarget
|
||||
if (isLockingOn && base.currentTarget != null && !base.isCharacterAlive())
|
||||
{
|
||||
// Debug.Log($"bLockOn: Locked target {base.currentTarget.name} died. Attempting to find new one or unlock.");
|
||||
Transform oldDeadTarget = base.currentTarget;
|
||||
AttemptLockOn(null, oldDeadTarget); // Try to find a new target, excluding the dead one for this attempt
|
||||
// OLD CODE THAT CAUSED THE PROBLEM:
|
||||
// This code made bLockOn find a new target using its own (incorrect) logic.
|
||||
// Transform oldDeadTarget = base.currentTarget;
|
||||
// AttemptLockOn(null, oldDeadTarget);
|
||||
|
||||
// ---
|
||||
|
||||
// NEW, CORRECTED CODE:
|
||||
// Instead of finding a target itself, it now tells the AutoTargetting system
|
||||
// to handle it. This ensures all your distance rules are always respected.
|
||||
if (autoTargetingSystem != null)
|
||||
{
|
||||
// The 'true' parameter tells AutoTargetting to find a new target immediately.
|
||||
autoTargetingSystem.ClearTarget(true);
|
||||
}
|
||||
else
|
||||
{
|
||||
// As a fallback, if the auto-targeting system isn't found, just unlock.
|
||||
UnlockTarget();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Attempts to lock onto a target. If preferredTarget is provided and valid, locks that.
|
||||
/// Otherwise, finds the best available target.
|
||||
|
||||
Reference in New Issue
Block a user