Decals, ghost textures, placement functionality, builder stub ins, a new camera system, and more.
37 lines
1.4 KiB
C#
37 lines
1.4 KiB
C#
// Assets/_Project/Scripts/Gameplay/TowerPlacementTestTrigger.cs
|
|
using UnityEngine;
|
|
using UnityEngine.InputSystem;
|
|
using TD.Towers;
|
|
|
|
namespace TD.Gameplay
|
|
{
|
|
/// <summary>
|
|
/// TEMPORARY test helper. Press 1 to begin placing the assigned tower.
|
|
/// Will be replaced by HUD tower buttons in a later path. Delete this script
|
|
/// once the HUD is wired up.
|
|
/// </summary>
|
|
public class TowerPlacementTestTrigger : MonoBehaviour
|
|
{
|
|
[Tooltip("The TowerDefinition to place when '1' is pressed.")]
|
|
[SerializeField] private TowerDefinition towerToPlace;
|
|
|
|
[Tooltip("The tower type ID. Must match the index of this TowerDefinition in " +
|
|
"TowerPlacementManager.towerDefinitions[]. Default 1 (slot 0 is reserved).")]
|
|
[SerializeField] private int towerTypeId = 1;
|
|
|
|
[Tooltip("The TowerPlacementController to drive.")]
|
|
[SerializeField] private TowerPlacementController controller;
|
|
|
|
private void Update()
|
|
{
|
|
var kb = Keyboard.current;
|
|
if (kb == null || controller == null || towerToPlace == null) return;
|
|
|
|
if (kb.digit1Key.wasPressedThisFrame)
|
|
{
|
|
controller.BeginPlacement(towerToPlace, towerTypeId);
|
|
Debug.Log($"[TestTrigger] BeginPlacement({towerToPlace.DisplayName}, id={towerTypeId})");
|
|
}
|
|
}
|
|
}
|
|
}
|