Tactical view is hands-off: every direct ship input pauses and the ship holds its last commands [ruling tactical-input-hands-off]
TacticalView.Direct (= !Tactical) is the one gate; ActionGameManager's presses, polled move/turn/face-aim/tractor and mouse look consult it. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
631653d940
commit
e93e900bf3
3 changed files with 58 additions and 14 deletions
|
|
@ -332,7 +332,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
Input.Global.Enable();
|
||||
|
||||
// The latch is the game's own, so it can disagree with the keyboard's Caps Lock light: show it.
|
||||
Input.Player.ToggleFaceAim.performed += context => _helm.Toggle();
|
||||
Input.Player.ToggleFaceAim.performed += context => { if (_tactical.Direct) _helm.Toggle(); };
|
||||
var markParent = GameplayUI != null ? GameplayUI.transform : UiRoot.transform;
|
||||
var markObject = new GameObject("Face Aim Mark", typeof(RectTransform));
|
||||
markObject.transform.SetParent(markParent, false);
|
||||
|
|
@ -348,6 +348,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
_zoomLevelIndex = Settings.DefaultMinimapZoom;
|
||||
Input.Player.MinimapZoom.performed += context =>
|
||||
{
|
||||
if (!_tactical.Direct) return;
|
||||
_zoomLevelIndex = (_zoomLevelIndex + 1) % Settings.MinimapZoomLevels.Length;
|
||||
ZoneRenderer.MinimapDistance = Settings.MinimapZoomLevels[_zoomLevelIndex];
|
||||
};
|
||||
|
|
@ -455,39 +456,43 @@ public class ActionGameManager : MonoBehaviour
|
|||
|
||||
Input.Player.HideUI.performed += context =>
|
||||
{
|
||||
if (!_tactical.Direct) return;
|
||||
_uiHidden = !_uiHidden;
|
||||
GameplayUI.alpha = _uiHidden ? 0 : 1;
|
||||
ActionBar.gameObject.SetActive(!_uiHidden);
|
||||
};
|
||||
|
||||
// Ruling tactical-input-hands-off: every direct ship input below pauses while TacticalView says it is not Direct (the
|
||||
// presses here, the polled axes and the look in Update; the action bar is disabled with the view). The ship holds its
|
||||
// last commands until the flight view returns.
|
||||
// The switches and the ping are presses on the entity's command, flipped at the next step.
|
||||
Input.Player.OverrideShutdown.performed += context => CurrentEntity.Command.ToggleOverrideShutdown();
|
||||
Input.Player.Ping.performed += context => CurrentEntity.Command.Ping();
|
||||
Input.Player.OverrideShutdown.performed += context => { if (_tactical.Direct) CurrentEntity.Command.ToggleOverrideShutdown(); };
|
||||
Input.Player.Ping.performed += context => { if (_tactical.Direct) CurrentEntity.Command.Ping(); };
|
||||
// TODO: SFX: Success/Fail
|
||||
Input.Player.ToggleHeatsinks.performed += context => CurrentEntity.Command.ToggleHeatsinks();
|
||||
Input.Player.ToggleHeatsinks.performed += context => { if (_tactical.Direct) CurrentEntity.Command.ToggleHeatsinks(); };
|
||||
// TODO: SFX: Success/Fail
|
||||
Input.Player.ToggleShield.performed += context => CurrentEntity.Command.ToggleShield();
|
||||
Input.Player.ToggleShield.performed += context => { if (_tactical.Direct) CurrentEntity.Command.ToggleShield(); };
|
||||
|
||||
// Flips the player's own stance on the current target between hostile and neutral. Going
|
||||
// neutral mid-fight safes weapons (Weapon.StanceAllowsFire); an unmarked/undetected target
|
||||
// reads as non-hostile, so the first press declares hostile. The flip reads the target and its stance when applied,
|
||||
// after the step's target presses, so two presses in a step cancel.
|
||||
Input.Player.ToggleStance.performed += context => CurrentEntity.Command.ToggleStance();
|
||||
Input.Player.ToggleStance.performed += context => { if (_tactical.Direct) CurrentEntity.Command.ToggleStance(); };
|
||||
|
||||
#region Targeting
|
||||
|
||||
// The reticle, nearest, next and previous presses each command a verb; the applier chooses through Entity at the
|
||||
// next step (mining target-queries cut): the rule lives with the entity, so the player, the test agent and any
|
||||
// director pick alike.
|
||||
Input.Player.TargetReticle.performed += context => CurrentEntity.Command.Verb(TargetVerb.UnderReticle);
|
||||
Input.Player.TargetNearest.performed += context => CurrentEntity.Command.Verb(TargetVerb.NearestEnemy);
|
||||
Input.Player.TargetNext.performed += context => CurrentEntity.Command.Verb(TargetVerb.Next);
|
||||
Input.Player.TargetPrevious.performed += context => CurrentEntity.Command.Verb(TargetVerb.Previous);
|
||||
Input.Player.TargetReticle.performed += context => { if (_tactical.Direct) CurrentEntity.Command.Verb(TargetVerb.UnderReticle); };
|
||||
Input.Player.TargetNearest.performed += context => { if (_tactical.Direct) CurrentEntity.Command.Verb(TargetVerb.NearestEnemy); };
|
||||
Input.Player.TargetNext.performed += context => { if (_tactical.Direct) CurrentEntity.Command.Verb(TargetVerb.Next); };
|
||||
Input.Player.TargetPrevious.performed += context => { if (_tactical.Direct) CurrentEntity.Command.Verb(TargetVerb.Previous); };
|
||||
|
||||
// Cut 2 (docs/fire-control-cut.md): steps the aim through the target's schematic rows -- every mount this ship
|
||||
// has located, empty or not, minus the ones it saw destroyed. Decides nothing: the entity owns the cycle, applied at
|
||||
// the next step.
|
||||
Input.Player.CycleTargetItem.performed += context => CurrentEntity.Command.CycleAim();
|
||||
Input.Player.CycleTargetItem.performed += context => { if (_tactical.Direct) CurrentEntity.Command.CycleAim(); };
|
||||
|
||||
#endregion
|
||||
|
||||
|
|
@ -1554,7 +1559,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
PlaceFill(indicator.Value, indicator.Key);
|
||||
}
|
||||
// The tactical view does not steer: the aim and the chase yaw hold while the mouse pans the view.
|
||||
if (!_tactical.Tactical)
|
||||
if (_tactical.Direct)
|
||||
{
|
||||
var look = Input.Player.Look.ReadValue<Vector2>();
|
||||
var sensitivity = PlayerSettings.InputSettings.Sensitivity;
|
||||
|
|
@ -1569,7 +1574,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
max(Settings.HeatstrokePhasingFloor, sin(Time.time * Settings.HeatstrokePhasingFrequency));
|
||||
|
||||
_faceAimMark.enabled = _helm.Latched;
|
||||
if(CurrentEntity is Ship ship)
|
||||
if(CurrentEntity is Ship ship && _tactical.Direct)
|
||||
{
|
||||
ship.Command.Movement = Input.Player.Move.ReadValue<Vector2>().ToCultMath();
|
||||
_helm.Held = Input.Player.FaceAim.IsPressed();
|
||||
|
|
@ -1591,7 +1596,7 @@ public class ActionGameManager : MonoBehaviour
|
|||
TargetShieldsFill.fillAmount = target.Shield == null ? 0 : lerp(.25f, .75f, target.Shield.Progress);
|
||||
}
|
||||
|
||||
CurrentEntity.Command.Tractor = Input.Player.TractorBeam.ReadValue<float>();
|
||||
if (_tactical.Direct) CurrentEntity.Command.Tractor = Input.Player.TractorBeam.ReadValue<float>();
|
||||
}
|
||||
}
|
||||
// One clock steps the zone, paused or not: a paused frame feeds it no real time.
|
||||
|
|
|
|||
|
|
@ -48,6 +48,10 @@ public sealed class TacticalView
|
|||
// Derived, never stored: the commanded position is past the detent's crest.
|
||||
public bool Tactical => Commanded > _crest;
|
||||
|
||||
// Whether direct ship input is taken (ruling tactical-input-hands-off): in the tactical view every keyboard, mouse and
|
||||
// toggle input pauses and the ship holds its last commands. The one expression of that gate; nothing else stores it.
|
||||
public bool Direct => !Tactical;
|
||||
|
||||
// What the camera is: the eased position.
|
||||
public float Distance => exp(_eased);
|
||||
|
||||
|
|
|
|||
|
|
@ -422,4 +422,39 @@ public sealed class TacticalViewTests
|
|||
Settle(view);
|
||||
Assert.Equal(new float2(500, 500), view.Target);
|
||||
}
|
||||
|
||||
// Ruling tactical-input-hands-off: ActionGameManager takes keyboard flight, toggles, mouse look and fire only while Direct,
|
||||
// so the ship holds its last commands through the tactical view and takes input again on return.
|
||||
[Fact]
|
||||
public void DirectInputIsTakenInFlightPausesInTacticalAndReturnsWithTheFlightView()
|
||||
{
|
||||
var view = Make();
|
||||
Assert.True(view.Direct);
|
||||
Assert.False(view.Tactical);
|
||||
|
||||
Cross(view);
|
||||
Assert.True(view.Tactical);
|
||||
Assert.False(view.Direct);
|
||||
for (var i = 0; i < 40; i++) { view.Tick(.05f); Assert.False(view.Direct); }
|
||||
|
||||
Cross(view, -1);
|
||||
Assert.False(view.Tactical);
|
||||
Assert.True(view.Direct);
|
||||
|
||||
Cross(view);
|
||||
view.Reset(Radius, BaseDistance, new float2(0, 0));
|
||||
Assert.True(view.Direct);
|
||||
}
|
||||
|
||||
[Fact]
|
||||
public void DirectIsPausedExactlyWhereTacticalIsAtEveryNotchOfTheDetent()
|
||||
{
|
||||
var view = Make();
|
||||
for (var i = 0; i < 80; i++)
|
||||
{
|
||||
view.Scroll(i < 40 ? 1 : -1);
|
||||
view.Tick(.02f);
|
||||
Assert.Equal(!view.Tactical, view.Direct);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue