public void PickUpCollectable(GameObject collectable) { audioSource.clip = pickUpCollectable; audioSource.Play(); hasCollectable = true; pool.ReleaseObject(collectable); spawnCollectables.SpawnCollectable(); }
private void OnCollisionEnter(Collision collision) { if (collision.transform.tag == "Message") { Debug.Log(collision); playerMessageSystem.PickUpMessage(collision.transform.position); poolBehaviour.ReleaseObject(collision.gameObject); } if (collision.transform.tag == "Player" && playerMessageSystem.isCarryingMessage) { PlayerManager otherPlayerManager = collision.gameObject.GetComponent <PlayerManager>(); if (otherPlayerManager.playerNumber == playerMessageSystem.messageColor) { playerMessageSystem.DeliverMessage(); } } }