void applyStasis() { StaticUntilTouched sut = swapTarget.AddComponent <StaticUntilTouched>(); sut.onRootedChanged += (rooted) => { if (!rooted) { Destroy(sut); } }; onStasis?.Invoke(playerController.gameObject, swapTarget); }
private void pickupObject(Rigidbody2D collRB2D, bool setPosition) { //StaticUntilTouched StaticUntilTouched sut = collRB2D.GetComponent <StaticUntilTouched>(); if (sut) { sut.Rooted = false; } //Pick up object if (setPosition) { collRB2D.transform.position = clawCollider.bounds.center; } collRB2D.velocity = rb2d.velocity; collRB2D.angularVelocity = 0; heldRB2D = collRB2D; }