Start hit feedback on its first rendered frame
This commit is contained in:
parent
ea647e7dff
commit
f77b53ba97
2 changed files with 10 additions and 1 deletions
|
|
@ -24,6 +24,7 @@ namespace GameCult.Eve.UnityScene
|
|||
private LineRenderer? _hitB;
|
||||
private Material? _material;
|
||||
private float _hitUntil;
|
||||
private float _pendingHitDuration;
|
||||
private EveUnityCombatPresentation? _lastPresentation;
|
||||
private Vector3 _lastCenter;
|
||||
private Vector3 _lastRight;
|
||||
|
|
@ -55,6 +56,11 @@ namespace GameCult.Eve.UnityScene
|
|||
|
||||
public void RefreshNow()
|
||||
{
|
||||
if (_pendingHitDuration > 0)
|
||||
{
|
||||
_hitUntil = Time.unscaledTime + _pendingHitDuration;
|
||||
_pendingHitDuration = 0;
|
||||
}
|
||||
Current = EveUnityCombatPresentation.Find(_host?.ActiveProjection);
|
||||
if (Current == null || string.IsNullOrWhiteSpace(Current.SelectedTargetEntityId))
|
||||
{
|
||||
|
|
@ -138,7 +144,7 @@ namespace GameCult.Eve.UnityScene
|
|||
_lastUp = up;
|
||||
_lastRadius = Math.Max(0.8f, _lastRadius);
|
||||
_hasLastTarget = true;
|
||||
_hitUntil = Time.unscaledTime + presentation.HitMarkerDurationSeconds;
|
||||
_pendingHitDuration = Math.Max(_pendingHitDuration, presentation.HitMarkerDurationSeconds);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -54,6 +54,9 @@ namespace GameCult.Eve.UnityScene.Tests
|
|||
typeof(EveUnityCombatPresentationRenderer)
|
||||
.GetMethod("OnShotAvailable", BindingFlags.Instance | BindingFlags.NonPublic)!
|
||||
.Invoke(renderer, new object[] { Shot(4, 9, true, 12, 0, "7.5,-3.25") });
|
||||
typeof(EveUnityCombatPresentationRenderer)
|
||||
.GetField("_hitUntil", BindingFlags.Instance | BindingFlags.NonPublic)!
|
||||
.SetValue(renderer, Time.unscaledTime - 1f);
|
||||
|
||||
renderer.RefreshNow();
|
||||
|
||||
|
|
|
|||
Reference in a new issue