Move reticle targeting into daemon operations
This commit is contained in:
parent
1f47ea387b
commit
712c34bf52
7 changed files with 168 additions and 9 deletions
|
|
@ -2057,12 +2057,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
|
||||
Input.Player.TargetReticle.performed += context =>
|
||||
{
|
||||
if (!CurrentEntity.VisibleEnemies.Any()) return;
|
||||
var underReticle = CurrentEntity.VisibleEnemies.Where(x => x != CurrentEntity)
|
||||
.MaxBy(x => CultMath.math.dot(
|
||||
CultMath.math.normalize(x.CultPosition - CurrentEntity.CultPosition),
|
||||
CurrentEntity.CultLookDirection));
|
||||
RequestTargetSelection(CurrentEntity.Target.Value == underReticle ? null : underReticle);
|
||||
RequestTargetReticle();
|
||||
};
|
||||
|
||||
Input.Player.TargetNearest.performed += context =>
|
||||
|
|
@ -3744,6 +3739,11 @@ public class ActionGameManager : MonoBehaviour
|
|||
TryRequestDaemonTargetCycle(AetheriaRuntimeDaemonCommandKinds.TargetPrevious);
|
||||
}
|
||||
|
||||
private void RequestTargetReticle()
|
||||
{
|
||||
TryRequestDaemonTargetReticle(_viewDirection);
|
||||
}
|
||||
|
||||
private bool TryRequestDaemonTargetSelection(Entity target)
|
||||
{
|
||||
var observer = ResolveDaemonObserver();
|
||||
|
|
@ -3776,6 +3776,26 @@ public class ActionGameManager : MonoBehaviour
|
|||
}
|
||||
}
|
||||
|
||||
private bool TryRequestDaemonTargetReticle(Vector3 lookDirection)
|
||||
{
|
||||
var observer = ResolveDaemonObserver();
|
||||
if (observer == null || !observer.HasAuthoritativeState)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
try
|
||||
{
|
||||
observer.Operations.TargetReticle(lookDirection.x, lookDirection.y, lookDirection.z);
|
||||
return true;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogWarning($"Failed to send Aetheria daemon reticle target operation; operation not submitted: {ex.Message}");
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private bool TryRequestDaemonTargetCycle(AetheriaRuntimeDaemonCommandKinds command)
|
||||
{
|
||||
var observer = ResolveDaemonObserver();
|
||||
|
|
|
|||
|
|
@ -35,6 +35,11 @@ public sealed class AetheriaDaemonOperations
|
|||
return Send((client, observed) => client.TargetPrevious(observed));
|
||||
}
|
||||
|
||||
public AetheriaRuntimeDaemonCommandEnvelope TargetReticle(double directionX, double directionY, double directionZ)
|
||||
{
|
||||
return Send((client, observed) => client.TargetReticle(observed, directionX, directionY, directionZ));
|
||||
}
|
||||
|
||||
public AetheriaRuntimeDaemonCommandEnvelope SetMoveVector(
|
||||
double directionX,
|
||||
double directionY,
|
||||
|
|
|
|||
Loading…
Reference in a new issue