ClickManagerTest.cs 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  1. using UnityEngine;
  2. /// <summary>
  3. /// Test script to verify the new click management system is working correctly.
  4. /// This can be attached to any GameObject to test the ClickManager functionality.
  5. /// </summary>
  6. public class ClickManagerTest : MonoBehaviour
  7. {
  8. [Header("Test Settings")]
  9. public bool showDebugInfo = true;
  10. public KeyCode testKey = KeyCode.T;
  11. void Update()
  12. {
  13. if (Input.GetKeyDown(testKey))
  14. {
  15. TestClickManager();
  16. }
  17. if (Input.GetMouseButtonDown(0) && showDebugInfo)
  18. {
  19. TestClickBlocking();
  20. }
  21. }
  22. void TestClickManager()
  23. {
  24. if (ClickManager.Instance != null)
  25. {
  26. Debug.Log("✅ ClickManager is working!");
  27. ClickManager.Instance.ListRegisteredBlockers();
  28. }
  29. else
  30. {
  31. Debug.LogError("❌ ClickManager is not available!");
  32. }
  33. }
  34. void TestClickBlocking()
  35. {
  36. Vector2 mousePos = Input.mousePosition;
  37. bool isBlocked = ClickManager.Instance != null && ClickManager.Instance.IsClickBlocked(mousePos);
  38. Debug.Log($"🖱️ Click at {mousePos}: {(isBlocked ? "BLOCKED" : "ALLOWED")}");
  39. }
  40. }