void OnTriggerEnter(Collider c) { WheelVehicle cart = c.gameObject.GetComponent <WheelVehicle>(); Debug.Log(c.gameObject); if (!cart) { return; } PowerUpSlot slot = cart.GetComponent <PowerUpSlot>(); if (slot.load(item)) { Destroy(gameObject); } }
private void Update() { if (Input.GetButtonDown("EnterVehicle")) { if (insideCar) { currentVehicle.exit(); } else if (nearestCar != null) { nearestCar.GetComponent <Peque.Vehicle>().enter(); } } if (Input.GetKeyDown(KeyCode.Escape)) { Application.Quit(); } }