Над физикой работаю. Добаил UI минимальное
This commit is contained in:
1 parent
48753f65fb
commit
f9ec01d1c8
912 files changed
+204440
-3555
No files matched your search
@@ -5,6 +5,9 @@ public class PlayerInteractor : MonoBehaviour
|
||||
[SerializeField] private float interactRange = 3f;
|
||||
[SerializeField] private LayerMask interactableLayer; // Создайте слой "Interactable" в Unity
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private UIManager uiManager;
|
||||
|
||||
private void Update()
|
||||
{
|
||||
// Пускаем луч из центра экрана
|
||||
@@ -16,15 +19,18 @@ public class PlayerInteractor : MonoBehaviour
|
||||
|
||||
if (interactable != null)
|
||||
{
|
||||
// Здесь в будущем можно выводить UI текст interactable.GetPrompt() на экран
|
||||
uiManager.ShowPrompt(interactable.GetPrompt());
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.E))
|
||||
{
|
||||
// Передаем корневой объект игрока (не камеру)
|
||||
Debug.Log("Кнопка нажата");
|
||||
interactable.Interact(transform.root.gameObject);
|
||||
uiManager.HidePrompt();
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uiManager.HidePrompt();
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user