void Update() { transform.Rotate(new Vector3(0f, -(speed * Time.deltaTime), 0f), Space.Self); if (!isParent) { speed = parentScript.getSpeed() / 4; } }
private void OnTriggerStay(Collider other) { if (other.gameObject.CompareTag("UngaBunga Item")) { if (other.gameObject.transform.parent != transform) { other.gameObject.transform.parent = transform; other.gameObject.transform.GetComponent <UngaBungaItemsMovement>().enabled = true; other.gameObject.transform.GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll; if (other.gameObject.layer != 0) { counter++; } other.gameObject.layer = 0; movement.setSpeed(movement.getSpeed() + 8f); } } }