void OnTriggerEnter(Collider collider) { if (collider.CompareTag("Player") && switchesPuzzle.solved()) { door.GetComponent <Animation>().Play("open"); } }
void Awake() { player = GameObject.FindGameObjectWithTag("Player"); slidingPuzzle = GameObject.FindObjectOfType <SlidingPuzzle>(); switchesPuzzle = GameObject.FindObjectOfType <SwitchPuzzle>(); colorPuzzle = GameObject.FindGameObjectWithTag("ColorPuzzle"); treeCollider = GameObject.FindGameObjectWithTag("Tree").GetComponent <Collider>(); if (slidingPuzzle && switchesPuzzle && colorPuzzle) { Destroy(treeCollider); } if (colorPuzzle) { player.transform.position = new Vector3(70, 9, 86); player.transform.Rotate(0, 20f, 0); } else if (switchesPuzzle.solved()) { player.transform.position = new Vector3(11, 9, 86); } else if (slidingPuzzle.solved()) { player.transform.position = new Vector3(-48, 9, 86); player.transform.Rotate(0, -37f, 0); } }