void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Car")) { pickedUp = true; LeanTween.moveY(gameObject, transform.position.y + 1.5f, 0.25f).setLoopPingPong(); LeanTween.scale(gameObject, Vector3.zero, 0.25f).setDelay(0.25f).setOnComplete(() => { gameObject.SetActive(false); }); Instantiate(particlesPrefab, transform.position, Quaternion.identity); PickedUpEvent?.Invoke(); } }
public override void BeginInteraction(NVRHand hand) { if (stillAttached) { //detached for the first time transform.SetParent(null, true); transform.localScale = Vector3.one * .2f; base.UpdateColliders(); //Palette will create another one onPickedUp.Invoke(iconId); stillAttached = false; } base.BeginInteraction(hand); }
public void PickedUp() { PickedUpEvent?.Invoke(this); Destroy(gameObject); }