autotargetting fix
This commit is contained in:
@@ -17140,7 +17140,7 @@ PrefabInstance:
|
|||||||
- target: {fileID: 3749252306457878305, guid: 851e8e61247888340bdec90fc8aa37f5,
|
- target: {fileID: 3749252306457878305, guid: 851e8e61247888340bdec90fc8aa37f5,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchoredPosition.x
|
propertyPath: m_AnchoredPosition.x
|
||||||
value: -26.000061
|
value: -26.000122
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 3806889720075550842, guid: 851e8e61247888340bdec90fc8aa37f5,
|
- target: {fileID: 3806889720075550842, guid: 851e8e61247888340bdec90fc8aa37f5,
|
||||||
type: 3}
|
type: 3}
|
||||||
@@ -17547,6 +17547,16 @@ PrefabInstance:
|
|||||||
propertyPath: m_IsActive
|
propertyPath: m_IsActive
|
||||||
value: 1
|
value: 1
|
||||||
objectReference: {fileID: 0}
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5054440825960491160, guid: 851e8e61247888340bdec90fc8aa37f5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: autoLockOnDistance
|
||||||
|
value: 2
|
||||||
|
objectReference: {fileID: 0}
|
||||||
|
- target: {fileID: 5054440825960491160, guid: 851e8e61247888340bdec90fc8aa37f5,
|
||||||
|
type: 3}
|
||||||
|
propertyPath: unlockDistanceThreshold
|
||||||
|
value: 3
|
||||||
|
objectReference: {fileID: 0}
|
||||||
- target: {fileID: 5083365752064418721, guid: 851e8e61247888340bdec90fc8aa37f5,
|
- target: {fileID: 5083365752064418721, guid: 851e8e61247888340bdec90fc8aa37f5,
|
||||||
type: 3}
|
type: 3}
|
||||||
propertyPath: m_AnchorMax.x
|
propertyPath: m_AnchorMax.x
|
||||||
@@ -19414,7 +19424,9 @@ MonoBehaviour:
|
|||||||
m_sunLight: {fileID: 1976683114}
|
m_sunLight: {fileID: 1976683114}
|
||||||
m_moonLight: {fileID: 0}
|
m_moonLight: {fileID: 0}
|
||||||
WeatherPresent: 0
|
WeatherPresent: 0
|
||||||
|
WeatherSystem: {fileID: 0}
|
||||||
m_sunLightExists: 1
|
m_sunLightExists: 1
|
||||||
|
m_moonLightExists: 0
|
||||||
--- !u!4 &1013064392
|
--- !u!4 &1013064392
|
||||||
Transform:
|
Transform:
|
||||||
m_ObjectHideFlags: 10
|
m_ObjectHideFlags: 10
|
||||||
@@ -22905,6 +22917,8 @@ MonoBehaviour:
|
|||||||
x: 250
|
x: 250
|
||||||
y: 250
|
y: 250
|
||||||
z: 250
|
z: 250
|
||||||
|
m_allFloatingPointFixMembers: []
|
||||||
|
m_allWorldSpaceParticleSystems: []
|
||||||
m_originTargetTileX: 0
|
m_originTargetTileX: 0
|
||||||
m_originTargetTileZ: 0
|
m_originTargetTileZ: 0
|
||||||
m_terrainUnloadMemoryTreshold: 4294967296
|
m_terrainUnloadMemoryTreshold: 4294967296
|
||||||
|
|||||||
@@ -169,8 +169,7 @@ namespace Beyond
|
|||||||
yield return new WaitForSeconds(targetingInterval);
|
yield return new WaitForSeconds(targetingInterval);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// REFACTORED: This method now has a clearer, more robust flow.
|
|
||||||
private void UpdateTarget()
|
private void UpdateTarget()
|
||||||
{
|
{
|
||||||
if (_playerTransform == null || _gameStateManager == null || _manualSwitchCooldownActive) return;
|
if (_playerTransform == null || _gameStateManager == null || _manualSwitchCooldownActive) return;
|
||||||
@@ -205,8 +204,7 @@ namespace Beyond
|
|||||||
// Step 3: Every update, evaluate and apply the correct lock-on state for the current target.
|
// Step 3: Every update, evaluate and apply the correct lock-on state for the current target.
|
||||||
UpdateLockOnState();
|
UpdateLockOnState();
|
||||||
}
|
}
|
||||||
|
|
||||||
// NEW: This method exclusively handles the logic for locking on and off.
|
|
||||||
private void UpdateLockOnState()
|
private void UpdateLockOnState()
|
||||||
{
|
{
|
||||||
if (targetLockSystem == null || _playerTransform == null) return;
|
if (targetLockSystem == null || _playerTransform == null) return;
|
||||||
@@ -216,8 +214,7 @@ namespace Beyond
|
|||||||
if (CurrentTarget != null && (autoLockSelectedTarget || alwaysLockOnInCombat))
|
if (CurrentTarget != null && (autoLockSelectedTarget || alwaysLockOnInCombat))
|
||||||
{
|
{
|
||||||
float distanceToTarget = Vector3.Distance(_playerTransform.position, CurrentTarget.transform.position);
|
float distanceToTarget = Vector3.Distance(_playerTransform.position, CurrentTarget.transform.position);
|
||||||
|
|
||||||
// This is a hysteresis check: use different distances for locking and unlocking to prevent flickering.
|
|
||||||
if (targetLockSystem.isLockingOn)
|
if (targetLockSystem.isLockingOn)
|
||||||
{
|
{
|
||||||
// If already locked, stay locked unless we are beyond the unlock threshold.
|
// If already locked, stay locked unless we are beyond the unlock threshold.
|
||||||
@@ -233,17 +230,16 @@ namespace Beyond
|
|||||||
// Synchronize the desired state with the lock-on system.
|
// Synchronize the desired state with the lock-on system.
|
||||||
Transform desiredLockTarget = shouldBeLocked ? CurrentTarget.transform : null;
|
Transform desiredLockTarget = shouldBeLocked ? CurrentTarget.transform : null;
|
||||||
|
|
||||||
// The lock-on system should be smart enough to not do anything if the target hasn't changed.
|
// --- THIS IS THE FIX ---
|
||||||
// We send the desired target (or null) every update.
|
// We now pass the 'shouldBeLocked' boolean to tell the system whether to lock or unlock.
|
||||||
targetLockSystem.ManuallySetLockOnTarget(desiredLockTarget, true);
|
targetLockSystem.ManuallySetLockOnTarget(desiredLockTarget, shouldBeLocked);
|
||||||
|
|
||||||
if (alwaysLockOnInCombat && desiredLockTarget != null && !targetLockSystem.isLockingOn)
|
if (alwaysLockOnInCombat && desiredLockTarget != null && !targetLockSystem.isLockingOn)
|
||||||
{
|
{
|
||||||
targetLockSystem.SetLockOn(true);
|
targetLockSystem.SetLockOn(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// SIMPLIFIED: This method now only handles changing the CurrentTarget reference and its visual highlight.
|
|
||||||
private void SetNewTarget(vFSMBehaviourController newTarget, bool forceLockSystemUpdate = false)
|
private void SetNewTarget(vFSMBehaviourController newTarget, bool forceLockSystemUpdate = false)
|
||||||
{
|
{
|
||||||
if (CurrentTarget == newTarget) return;
|
if (CurrentTarget == newTarget) return;
|
||||||
@@ -309,9 +305,6 @@ namespace Beyond
|
|||||||
if (targetLockSystem == null) return;
|
if (targetLockSystem == null) return;
|
||||||
_manualSwitchCooldownActive = true;
|
_manualSwitchCooldownActive = true;
|
||||||
_manualSwitchCooldownTimer = manualSwitchCooldownDuration;
|
_manualSwitchCooldownTimer = manualSwitchCooldownDuration;
|
||||||
|
|
||||||
// After manually unlocking, we let the main UpdateTarget loop find the next best candidate.
|
|
||||||
// If the previously locked target is still the closest, it will be re-highlighted automatically.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
@@ -347,23 +340,15 @@ namespace Beyond
|
|||||||
|
|
||||||
public void ClearTarget(bool findNewOneImmediately)
|
public void ClearTarget(bool findNewOneImmediately)
|
||||||
{
|
{
|
||||||
// --- FIX APPLIED HERE ---
|
|
||||||
|
|
||||||
// 1. Explicitly tell the lock-on system to unlock immediately.
|
|
||||||
// This is the crucial step that resets the 'isLockingOn' flag to false.
|
|
||||||
if (targetLockSystem != null)
|
if (targetLockSystem != null)
|
||||||
{
|
{
|
||||||
targetLockSystem.SetLockOn(false);
|
targetLockSystem.SetLockOn(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 2. Deselect the current target and remove its highlight.
|
|
||||||
SetNewTarget(null);
|
SetNewTarget(null);
|
||||||
|
|
||||||
// 3. If requested, immediately find a new target.
|
|
||||||
if (findNewOneImmediately && _gameStateManager != null && _gameStateManager.CurrentState == GameStateManager.State.COMBAT)
|
if (findNewOneImmediately && _gameStateManager != null && _gameStateManager.CurrentState == GameStateManager.State.COMBAT)
|
||||||
{
|
{
|
||||||
// Now, when UpdateTarget() runs, 'isLockingOn' will be correctly set to false,
|
|
||||||
// forcing the system to use the stricter 'autoLockOnDistance' for the new candidate.
|
|
||||||
if (!_manualSwitchCooldownActive)
|
if (!_manualSwitchCooldownActive)
|
||||||
{
|
{
|
||||||
UpdateTarget();
|
UpdateTarget();
|
||||||
|
|||||||
@@ -849,7 +849,7 @@ PlayerSettings:
|
|||||||
webWasm2023: 0
|
webWasm2023: 0
|
||||||
scriptingDefineSymbols:
|
scriptingDefineSymbols:
|
||||||
: UNITY_POST_PROCESSING_STACK_V2
|
: UNITY_POST_PROCESSING_STACK_V2
|
||||||
Android: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;USE_TIMELINE;USE_NEW_INPUT;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;TMP_PRESENT;ENEMIES_DISABLED
|
Android: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;USE_TIMELINE;USE_NEW_INPUT;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;TMP_PRESENT;ENEMIES_DISABLED;MOBILE_INPUT
|
||||||
CloudRendering: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
CloudRendering: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
||||||
EmbeddedLinux: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
EmbeddedLinux: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
||||||
GameCoreScarlett: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
GameCoreScarlett: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
||||||
@@ -867,9 +867,9 @@ PlayerSettings:
|
|||||||
Standalone: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;TOUCH_REACT;GAIA_2_PRESENT;INVECTOR_AI_TEMPLATE;UPPipeline;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3;ENEMIES_DISABLED
|
Standalone: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;TOUCH_REACT;GAIA_2_PRESENT;INVECTOR_AI_TEMPLATE;UPPipeline;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3;ENEMIES_DISABLED
|
||||||
VisionOS: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
VisionOS: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
||||||
WebGL: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
WebGL: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
||||||
Windows Store Apps: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
Windows Store Apps: UNITY_POST_PROCESSING_STACK_V2;CROSS_PLATFORM_INPUT;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;MOBILE_INPUT
|
||||||
XboxOne: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
XboxOne: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
||||||
iPhone: CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;GAIA_2_PRESENT;GAIA_PRO_PRESENT;UPPipeline;UNITY_POST_PROCESSING_STACK_V2;TOUCH_REACT;INVECTOR_AI_TEMPLATE;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_INVECTOR_INVENTORY;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3;ENEMIES_DISABLED
|
iPhone: CROSS_PLATFORM_INPUT;INVECTOR_BASIC;INVECTOR_MELEE;GAIA_2_PRESENT;GAIA_PRO_PRESENT;UPPipeline;UNITY_POST_PROCESSING_STACK_V2;TOUCH_REACT;INVECTOR_AI_TEMPLATE;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER;URP_OUTLINE;ODIN_INSPECTOR;ODIN_INSPECTOR_3;TMP_PRESENT;USE_INVECTOR_INVENTORY;USE_TIMELINE;ODIN_INSPECTOR_3_1;ODIN_INSPECTOR_3_2;ODIN_INSPECTOR_3_3;ENEMIES_DISABLED;MOBILE_INPUT
|
||||||
tvOS: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
tvOS: UNITY_POST_PROCESSING_STACK_V2;PLAYMAKER;PLAYMAKER_1_9;PLAYMAKER_1_9_0;PLAYMAKER_1_8_OR_NEWER;PLAYMAKER_1_8_5_OR_NEWER;PLAYMAKER_1_9_OR_NEWER
|
||||||
additionalCompilerArguments: {}
|
additionalCompilerArguments: {}
|
||||||
platformArchitecture: {}
|
platformArchitecture: {}
|
||||||
|
|||||||
Reference in New Issue
Block a user