Created Scripts Folder

This commit is contained in:
Santi 2024-04-28 19:00:11 +01:00
parent 4e51e6d212
commit 080f9a3428
4 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@ public class PickUpObject : MonoBehaviour
public bool carrying = false; public bool carrying = false;
public GameObject carriableObject; public GameObject carriableObject;
public float throwForce; public float throwForce;
public KeyCode interactKey = KeyCode.F;
// Start is called before the first frame update // Start is called before the first frame update
void Start() void Start()
{ {
@ -20,12 +21,12 @@ public class PickUpObject : MonoBehaviour
// Update is called once per frame // Update is called once per frame
void Update() void Update()
{ {
if(insideTrigger && Input.GetKeyDown(KeyCode.F) && !carrying) if(insideTrigger && Input.GetKeyDown(interactKey) && !carrying)
{ {
carrying = true; carrying = true;
carriableObject.GetComponent<Rigidbody>().isKinematic = true; carriableObject.GetComponent<Rigidbody>().isKinematic = true;
} }
else if(carrying && Input.GetKeyDown(KeyCode.F)) else if(carrying && Input.GetKeyDown(interactKey))
{ {
carrying = false; carrying = false;
carriableObject.GetComponent<Rigidbody>().isKinematic = false; carriableObject.GetComponent<Rigidbody>().isKinematic = false;