// implementing coin pick up and finish line // calls a script in the FlyingPaper class void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Coin")) { // call CoinPickup() in the FlyingPaper script fpScript.CoinPickup(other); } else if (other.gameObject.CompareTag("Finish")) { // call FinishLine() in the FlyingPaper script finished = true; fpScript.FinishLine(); } }
// implementing coin pick up, finish line, and teleporter // calls a script in the FlyingPaper class void OnTriggerEnter(Collider other) { if (other.gameObject.CompareTag("Coin")) { fpScript.CoinPickup(other); } else if (other.gameObject.CompareTag("Finish")) { rb = this.GetComponent <Rigidbody>(); finished = true; fpScript.FinishLine(); } else if (other.gameObject.CompareTag("key")) { fpScript.GateAndKey(other); } }