private void processEnemyCollision(RaycastHit2D hit) { print("ENEMY"); BodyPartInventoryManager bodyManager = GameObject.FindObjectOfType <BodyPartInventoryManager>(); GameObject bodyPart = bodyManager.RemoveLastBodyPart(); if (bodyPart != null) { bodyPart.SetActive(true); } GetComponent <AudioSource>().clip = happySfx; print(GetComponent <AudioSource>().isPlaying); if (!GetComponent <AudioSource>().isPlaying) { GetComponent <AudioSource>().Play(); } }
private void processBodyPartCollision(RaycastHit2D hit) { if (text != null) { text.SetActive(true); if (Input.GetKeyUp(KeyCode.Space)) { GameObject bodyPart = hit.collider.gameObject; BodyPartInventoryManager bodyManager = GameObject.FindObjectOfType <BodyPartInventoryManager>(); bodyManager.CollectBodyPart(bodyPart); GetComponent <AudioSource>().clip = happySfx; print(GetComponent <AudioSource>().isPlaying); if (!GetComponent <AudioSource>().isPlaying) { GetComponent <AudioSource>().Play(); } hit.collider.gameObject.SetActive(false); } } }