public storePickup ( AbstractPickup, pickup ) : bool | ||
pickup | AbstractPickup, | |
return | bool |
protected void storePickup(PickupInventory inventory) { bool stored = inventory.storePickup(this); if (stored) { //hide the pickup now under the player. Collider col = gameObject.GetComponent<Collider>(); if (col) { col.enabled = false; //disable collisions so it won't fire off again } Renderer rend = gameObject.GetComponent<Renderer>(); if (rend) { rend.enabled = false; //hide the mesh } transform.parent = inventory.gameObject.transform; //make it a child of the player. } }
protected void storePickup(PickupInventory inventory) { bool stored = inventory.storePickup(this); if (stored) { //hide the pickup now under the player. Collider col = gameObject.GetComponent <Collider>(); if (col) { col.enabled = false; //disable collisions so it won't fire off again } Renderer rend = gameObject.GetComponent <Renderer>(); if (rend) { rend.enabled = false; //hide the mesh } transform.parent = inventory.gameObject.transform; //make it a child of the player. } }