void Update() { redScript = GameObject.Find("") if (Input.GetButtonDown("X Button")) { blue = !blue; } }
void OnCollisionEnter2D(Collision2D other) { //Instantiate(brickParticle, transform.position, Quaternion.identity); //GM.instance.DestroyBrick(); if (other.gameObject.tag == ("BrickTime")) { Vector3 objectLocation = other.gameObject.transform.position; source.PlayOneShot(DestroySound, volHighRange); animator.SetTrigger("Horizontal"); Destroy(other.gameObject); TimeSlider.value += .05f; GM2.instance.DestroyBrick(objectLocation); } if (other.gameObject.tag == ("BrickSpeed")) { Vector3 objectLocation = other.gameObject.transform.position; source.PlayOneShot(DestroySound, volHighRange); animator.SetTrigger("Horizontal"); Destroy(other.gameObject); TimeSlider.value += .005f; GM2.instance.DestroyBrick(objectLocation); } if (other.gameObject.tag == ("Blue_Brick")) { source.PlayOneShot(DestroySound, volHighRange); animator.SetTrigger("Horizontal"); Blue_Script blueScript = other.gameObject.GetComponent <Blue_Script> (); Vector3 objectLocation = blueScript.spawnLocation; Destroy(other.gameObject); TimeSlider.value += .05f; GM2.instance.DestroyBrick(objectLocation); } if (other.gameObject.tag == ("Red_Brick")) { source.PlayOneShot(DestroySound, volHighRange); animator.SetTrigger("Horizontal"); //Destroy(other.gameObject); //TimeSlider.value += .005f; if (rb.velocity.magnitude > normalSpeed) { Vector3 objectLocation = other.gameObject.transform.position; Destroy(other.gameObject); GM2.instance.DestroyBrick(objectLocation, 2); } else { RedScript redScript = other.gameObject.GetComponent <RedScript> (); redScript.lives--; if (redScript.lives == 0) { Vector3 objectLocation = other.gameObject.transform.position; Destroy(other.gameObject); GM2.instance.DestroyBrick(objectLocation, 2); } } } if (other.gameObject.tag == ("Paddle")) { source.PlayOneShot(HitSound, volHighRange); animator.SetTrigger("Horizontal"); } if (other.gameObject.tag == ("Wall")) { source.PlayOneShot(HitSound, volHighRange); animator.SetTrigger("Vertical"); } if (other.gameObject.tag == ("Ball")) { source.PlayOneShot(HitSound, volHighRange); animator.SetTrigger("Vertical"); rb.velocity = new Vector2((rb.velocity.x * speedIn), (rb.velocity.y * speedIn)); } if (other.gameObject.tag == ("DeathZone")) { source.PlayOneShot(DeathSound, volHighRange); GM2.instance.LoseLife(); } }