void Start() { //assign variables chimes = GetComponents <AudioSource>(); chime1 = chimes[0]; chime2 = chimes[1]; chime3 = chimes[2]; chime4 = chimes[3]; chime5 = chimes[4]; chime6 = chimes[5]; player = GameObject.FindGameObjectWithTag("Baby"); boxControl = GameObject.FindGameObjectWithTag("ChestControl").GetComponent <ChestSpawner>(); maxHealth = playerHealth; }
private void OnTriggerEnter2D(Collider2D other) { if (other.CompareTag("Player")) { if (this.gameObject.CompareTag("Clue")) { TreasureClueSpawner.notifyClueCollected(1); } else if (this.gameObject.CompareTag("Clue 02")) { TreasureClueSpawner.notifyClueCollected(2); } else if (this.gameObject.CompareTag("Clue 03")) { ChestSpawner.notifyLastClueCollected(); } Destroy(this.gameObject); } }