Есть система снятия навесного с авто. Надо дорабатывать. Машины все добавлены
This commit is contained in:
1 parent
a8238ab49e
commit
3e13180e34
15 files changed
+106236
-141
No files matched your search
@@ -4,7 +4,9 @@ public class PlayerInteractor : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private float interactRange = 3f;
|
||||
[SerializeField] private LayerMask interactableLayer; // Создайте слой "Interactable" в Unity
|
||||
|
||||
[SerializeField] private KeyCode primaryKey = KeyCode.E;
|
||||
[SerializeField] private KeyCode secondaryKey = KeyCode.R;
|
||||
|
||||
[Header("References")]
|
||||
[SerializeField] private UIManager uiManager;
|
||||
|
||||
@@ -19,18 +21,41 @@ public class PlayerInteractor : MonoBehaviour
|
||||
|
||||
if (interactable != null)
|
||||
{
|
||||
uiManager.ShowPrompt(interactable.GetPrompt());
|
||||
if (!string.IsNullOrEmpty(interactable.GetPrompt()) && uiManager!=null)
|
||||
{
|
||||
uiManager.ShowPrompt(interactable.GetPrompt());
|
||||
}
|
||||
else if (uiManager != null)
|
||||
{
|
||||
uiManager.HidePrompt();
|
||||
}
|
||||
|
||||
|
||||
if (Input.GetKeyDown(KeyCode.E))
|
||||
if (Input.GetKeyDown(primaryKey))
|
||||
{
|
||||
interactable.Interact(transform.root.gameObject);
|
||||
uiManager.HidePrompt();
|
||||
}
|
||||
if (Input.GetKeyDown(secondaryKey))
|
||||
{
|
||||
ISecondaryInteractable secondary = hit.collider.GetComponentInParent<ISecondaryInteractable>();
|
||||
secondary?.SecondaryInteract(transform.root.gameObject);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
uiManager.HidePrompt();
|
||||
if (uiManager != null)
|
||||
{
|
||||
uiManager.HidePrompt();
|
||||
}
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
if (uiManager != null)
|
||||
{
|
||||
uiManager.HidePrompt();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user