tab once selects builder, tab twice focuses builder
This commit is contained in:
parent
826d7b5037
commit
fe2c59d326
6 changed files with 28 additions and 6 deletions
|
|
@ -2253,7 +2253,7 @@ MonoBehaviour:
|
|||
m_EditorClassIdentifier: Assembly-CSharp::TD.Audio.AudioManager
|
||||
categories:
|
||||
- category: 0
|
||||
maxVoices: 4
|
||||
maxVoices: 6
|
||||
volume: 0.5
|
||||
- category: 1
|
||||
maxVoices: 4
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
// Assets/_Project/Scripts/Audio/AudioCategory.cs
|
||||
namespace TD.Audio
|
||||
{
|
||||
public enum AudioCategory { TowerFire, EnemyHitDeath, UI }
|
||||
public enum AudioCategory { Combat, EnemyHitDeath, UI }
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,7 +38,7 @@ namespace TD.Combat
|
|||
|
||||
private void HandleAreaFired(Vector3[] positions)
|
||||
{
|
||||
AudioManager.Instance?.Play(fireSound.clip, AudioCategory.TowerFire, fireSound.RandomPitch(), fireSound.volume);
|
||||
AudioManager.Instance?.Play(fireSound.clip, AudioCategory.Combat, fireSound.RandomPitch(), fireSound.volume);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -156,7 +156,22 @@ namespace TD.Gameplay
|
|||
{
|
||||
HUDController.Instance?.ToggleBuffMenu();
|
||||
}
|
||||
|
||||
|
||||
// Tab: select the builder, or (if already selected) recenter the camera on it.
|
||||
if (keyboard != null && keyboard.tabKey.wasPressedThisFrame
|
||||
&& !HUDController.IsTextInputActive)
|
||||
{
|
||||
var selection = SelectionState.Instance;
|
||||
if (selection != null && selection.IsSelected(builder))
|
||||
{
|
||||
HUDController.Instance?.CenterCameraOnSelection();
|
||||
}
|
||||
else
|
||||
{
|
||||
selection?.Select(builder);
|
||||
}
|
||||
}
|
||||
|
||||
if (pointerOverHud) return;
|
||||
if (!mouse.rightButton.wasPressedThisFrame) return;
|
||||
|
||||
|
|
|
|||
|
|
@ -65,7 +65,7 @@ namespace TD.Gameplay.BuilderSpells
|
|||
Destroy(Instantiate(impactVfxPrefab, targetPoint, Quaternion.identity), impactVfxLifetime);
|
||||
|
||||
if (impactSound.clip != null)
|
||||
AudioManager.Instance?.Play(impactSound.clip, AudioCategory.TowerFire,
|
||||
AudioManager.Instance?.Play(impactSound.clip, AudioCategory.Combat,
|
||||
impactSound.RandomPitch(), impactSound.volume);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1642,7 +1642,14 @@ namespace TD.UI
|
|||
// WC3 / SC2 convention: clicking the portrait recenters the camera on
|
||||
// whoever is selected. Zoom is preserved (CameraController.JumpTo only
|
||||
// moves the pivot). No-op when nothing is selected or the camera isn't wired.
|
||||
private void OnPortraitClicked(ClickEvent evt)
|
||||
private void OnPortraitClicked(ClickEvent evt) => CenterCameraOnSelection();
|
||||
|
||||
/// <summary>
|
||||
/// Recenters the camera on the current selection (same behavior as clicking the
|
||||
/// portrait). No-op when nothing is selected or the camera isn't wired. Also used
|
||||
/// by the Tab hotkey (select-builder-then-focus) in BuilderInputController.
|
||||
/// </summary>
|
||||
public void CenterCameraOnSelection()
|
||||
{
|
||||
var sel = SelectionState.Instance?.SelectedObject;
|
||||
if (sel == null) return;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue