Exemplo n.º 1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Trigger")
     {
         if (other.gameObject.GetComponent <scrChangeCam>().toZoom)
         {
             sceneMan.mainCam.camMode = "Zoom";
             Object.Destroy(other);
         }
         else if (other.gameObject.GetComponent <scrChangeCam>().toFull)
         {
             sceneMan.mainCam.camMode = "Full";
             Object.Destroy(other);
         }
     }
     else if (other.gameObject.tag == "ResetPlane" && gameObject.name == "objBall")
     {
         GameObject objCap = GameObject.Find("objCapsule");
         objCap.gameObject.transform.position           = new Vector3(0.0f, 2.21f, 0.0f);
         gameObject.transform.position                  = new Vector3(0.05f, 1.12f, 0.0f);
         objCap.GetComponent <scrCapsule>().isResetting = true;
         sceneMan.ResetBall();
         for (int i = 0; i < currColList.Count; i++)
         {
             if (currColList[i].gameObject.tag == "Pegs" || currColList[i].gameObject.tag == "PegsOrange")
             {
                 currColList[i].gameObject.GetComponent <Collider2D>().isTrigger = true;
                 currColList[i].gameObject.GetComponent <SpriteRenderer>().color = new Color(1.0f, 1.0f, 1.0f, 0.5f);
             }
             currColList.Clear();
         }
     }
 }
Exemplo n.º 2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.gameObject.tag == "Trigger")
     {
         if (other.gameObject.GetComponent <scrChangeCam>().toZoom)
         {
             sceneMan.mainCam.camMode = "Zoom";
             Object.Destroy(other);
         }
         else if (other.gameObject.GetComponent <scrChangeCam>().toFull)
         {
             sceneMan.mainCam.camMode = "Full";
             Object.Destroy(other);
         }
     }
     else if (other.gameObject.tag == "ResetPlane" && gameObject.name == "objBall")
     {
         GameObject objCap = GameObject.Find("objCapsule");
         objCap.GetComponent <scrCapsule>().isResetting = true;
         foreach (GameObject greenPeg in GameObject.FindGameObjectsWithTag("PegsGreen"))
         {
             if (greenPeg.GetComponent <scrPeg>().isHit)
             {
                 Object.Destroy(greenPeg);
             }
         }
         if (!sceneMan.isWin)
         {
             sceneMan.ResetBall();
         }
         foreach (GameObject peg in GameObject.FindGameObjectsWithTag("Pegs"))
         {
             if (peg.GetComponent <scrPeg>().isHit)
             {
                 peg.gameObject.GetComponent <Collider2D>().isTrigger = true;
                 peg.gameObject.GetComponent <SpriteRenderer>().color = new Color(1.0f, 1.0f, 1.0f, 0.3f);
             }
         }
         foreach (GameObject peg in GameObject.FindGameObjectsWithTag("PegsOrange"))
         {
             if (peg.GetComponent <scrPeg>().isHit)
             {
                 peg.gameObject.GetComponent <Collider2D>().isTrigger = true;
                 peg.gameObject.GetComponent <SpriteRenderer>().color = new Color(1.0f, 1.0f, 1.0f, 0.3f);
             }
         }
         foreach (GameObject peg in GameObject.FindGameObjectsWithTag("PegsPurple"))
         {
             if (peg.GetComponent <scrPeg>().isHit)
             {
                 peg.gameObject.GetComponent <Collider2D>().isTrigger = true;
                 peg.gameObject.GetComponent <SpriteRenderer>().color = new Color(1.0f, 1.0f, 1.0f, 0.3f);
             }
             else
             {
                 peg.gameObject.GetComponent <scrPeg>().changeToBlue();
             }
         }
         currColList.Clear();
         ballColList.Clear();
     }
 }