// Use this for initialization void Start() { tiltAngle = 30.0f; smooth = 10.0f; rotationLimit = 40.0f; life = 1; timePassed = Time.time; mixLevels mixer = audioController.GetComponent <mixLevels>(); mixer.startMusic(); }
private void OnTriggerEnter2D(Collider2D collide) { if (collide.gameObject.tag == "layerTransition") { mixLevels mixer = audioController.GetComponent <mixLevels>(); currentLayer += 1; if (currentLayer == 2) { mixer.layerLevels(secondLayer); } if (currentLayer == 3) { mixer.layerLevels(thirdLayer); } } }
private void OnTriggerEnter2D(Collider2D collide) { if (collide.gameObject.tag == "treasure") { Text scoreNum = scoreUI.GetComponent <Text>(); collectableSpawner treasure = collide.gameObject.GetComponent <collectableSpawner>(); int numConvert = int.Parse(scoreNum.text); int displayValue = numConvert + treasure.collectableValue; scoreNum.text = displayValue.ToString(); GetComponent <AudioSource>().PlayOneShot(collect, 0.25f); treasure.spawnCalc(); } if (collide.gameObject.tag == "obstacle") { GetComponent <AudioSource>().PlayOneShot(crash, 0.7f); mixLevels mixer = audioController.GetComponent <mixLevels>(); mixer.mute(); life -= 1; } }