예제 #1
0
 void Reset()
 {
     isPlaying = false;
     isCopied  = false;
     B1.GetComponent <TrailRenderer>().time = 0.0f;
     B1.SetActive(false);
     B1.GetComponent <Ball>().Dead          = false;
     B2.GetComponent <TrailRenderer>().time = 0.0f;
     B2.SetActive(false);
     B2.GetComponent <Ball>().Dead = false;
     B3.SetActive(false);
     B3.GetComponent <TrailRenderer>().time = 0.0f;
     B3.GetComponent <Ball>().Dead          = false;
     B4.SetActive(false);
     B4.GetComponent <TrailRenderer>().time = 0.0f;
     B4.GetComponent <Ball>().Dead          = false;
     B5.SetActive(false);
     B5.GetComponent <TrailRenderer>().time = 0.0f;
     B5.GetComponent <Ball>().Dead          = false;
     B6.SetActive(false);
     B6.GetComponent <TrailRenderer>().time = 0.0f;
     B6.GetComponent <Ball>().Dead          = false;
     B7.SetActive(false);
     B7.GetComponent <TrailRenderer>().time = 0.0f;
     B7.GetComponent <Ball>().Dead          = false;
     ChangeColor(0);
 }
예제 #2
0
    public void setRespFalse()
    {
        A1.SetActive(false);
        A2.SetActive(false);
        A3.SetActive(false);
        A4.SetActive(false);
        A5.SetActive(false);
        A6.SetActive(false);
        A7.SetActive(false);

        B1.SetActive(false);
        B2.SetActive(false);
        B3.SetActive(false);
        B4.SetActive(false);
        B5.SetActive(false);
        B6.SetActive(false);
        B7.SetActive(false);

        C1.SetActive(false);
        C2.SetActive(false);
        C3.SetActive(false);
        C4.SetActive(false);
        C5.SetActive(false);
        C6.SetActive(false);
        C7.SetActive(false);
    }
예제 #3
0
    IEnumerator Rexar(int Layer, Collider2D other)
    {
        B1.SetActive(true);
        Tr1.position = Pos1;
        B1.layer     = Layer;
        B1.GetComponent <Ball> ().Direction = Direction1;

        B2.SetActive(true);
        Tr2.position = Pos2;
        B2.layer     = Layer;
        B2.GetComponent <Ball> ().Direction = Direction2;
        //Rb2 = other.GetComponent<Rigidbody2D> ();
        B3.SetActive(true);
        Tr3.position = Pos3;
        B3.layer     = Layer;
        B3.GetComponent <Ball> ().Direction = Direction2;

        B4.SetActive(true);
        Tr4.position = Pos4;
        B4.layer     = Layer;
        B4.GetComponent <Ball> ().Direction = Direction2;

        B5.SetActive(true);
        Tr5.position = Pos5;
        B5.layer     = Layer;
        B5.GetComponent <Ball> ().Direction = Direction2;

        B6.SetActive(true);
        Tr6.position = Pos6;
        B6.layer     = Layer;
        B6.GetComponent <Ball> ().Direction = Direction2;

        B7.SetActive(true);
        Tr7.position = Pos7;
        B7.layer     = Layer;
        B7.GetComponent <Ball> ().Direction = Direction2;
        yield return(new WaitForSeconds(0.1f));

        Rb1.Sleep();
        B1.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb2.Sleep();
        B2.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb3.Sleep();
        B3.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb4.Sleep();
        B4.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb5.Sleep();
        B5.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb6.Sleep();
        B6.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Rb7.Sleep();
        B7.GetComponent <TrailRenderer> ().time = Mathf.Infinity;
        Tr1.position = Pos1;
        Tr2.position = Pos2;
        Tr3.position = Pos3;
        Tr4.position = Pos4;
        Tr5.position = Pos5;
        Tr6.position = Pos6;
        Tr7.position = Pos7;



        if (Direction1.Equals(1))
        {
            Rb1.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction1.Equals(2))
        {
            Rb1.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction1.Equals(3))
        {
            Rb1.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction1.Equals(4))
        {
            Rb1.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction1.Equals(8))
        {
            Rb1.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction1.Equals(7))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction1.Equals(6))
        {
            Rb1.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction1.Equals(5))
        {
            Rb1.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction1.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction1.Equals(10))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction1.Equals(11))
        {
            Rb1.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction1.Equals(12))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction2.Equals(1))
        {
            Rb2.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction2.Equals(2))
        {
            Rb2.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction2.Equals(3))
        {
            Rb2.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction2.Equals(4))
        {
            Rb2.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction2.Equals(6))
        {
            Rb2.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction2.Equals(7))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction2.Equals(8))
        {
            Rb2.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction2.Equals(5))
        {
            Rb2.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction2.Equals(9))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction2.Equals(10))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction2.Equals(11))
        {
            Rb2.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction2.Equals(12))
        {
            Rb2.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction3.Equals(1))
        {
            Rb3.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction3.Equals(2))
        {
            Rb3.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction3.Equals(3))
        {
            Rb3.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction3.Equals(4))
        {
            Rb3.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction3.Equals(6))
        {
            Rb3.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction3.Equals(7))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction3.Equals(8))
        {
            Rb3.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction3.Equals(5))
        {
            Rb3.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction3.Equals(9))
        {
            Rb1.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction3.Equals(10))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction3.Equals(11))
        {
            Rb3.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction3.Equals(12))
        {
            Rb3.AddForce(V * new Vector2(178.9869f, -89.24f));
        }


        if (Direction4.Equals(1))
        {
            Rb4.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction4.Equals(2))
        {
            Rb4.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction4.Equals(3))
        {
            Rb4.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction4.Equals(4))
        {
            Rb4.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction4.Equals(6))
        {
            Rb4.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction4.Equals(7))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction4.Equals(8))
        {
            Rb4.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction4.Equals(5))
        {
            Rb4.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction4.Equals(9))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction4.Equals(10))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction4.Equals(11))
        {
            Rb4.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction4.Equals(12))
        {
            Rb4.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        if (Direction5.Equals(1))
        {
            Rb5.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction5.Equals(2))
        {
            Rb5.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction5.Equals(3))
        {
            Rb5.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction5.Equals(4))
        {
            Rb5.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction5.Equals(6))
        {
            Rb5.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction5.Equals(7))
        {
            Rb5.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction5.Equals(8))
        {
            Rb5.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction5.Equals(5))
        {
            Rb5.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction5.Equals(9))
        {
            Rb5.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction5.Equals(10))
        {
            Rb5.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction5.Equals(11))
        {
            Rb5.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction5.Equals(12))
        {
            Rb5.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        if (Direction6.Equals(1))
        {
            Rb6.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction6.Equals(2))
        {
            Rb6.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction6.Equals(3))
        {
            Rb6.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction6.Equals(4))
        {
            Rb6.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction6.Equals(6))
        {
            Rb6.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction6.Equals(7))
        {
            Rb6.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction6.Equals(8))
        {
            Rb6.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction6.Equals(5))
        {
            Rb6.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction6.Equals(9))
        {
            Rb6.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction6.Equals(10))
        {
            Rb6.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction6.Equals(11))
        {
            Rb6.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction6.Equals(12))
        {
            Rb6.AddForce(V * new Vector2(178.9869f, -89.24f));
        }

        if (Direction7.Equals(1))
        {
            Rb7.AddForce(V * new Vector2(200.0f, 0.0f));
        }
        if (Direction7.Equals(2))
        {
            Rb7.AddForce(V * new Vector2(0.0f, 200.0f));
        }
        if (Direction7.Equals(3))
        {
            Rb7.AddForce(V * new Vector2(-200.0f, 0.0f));
        }
        if (Direction7.Equals(4))
        {
            Rb7.AddForce(V * new Vector2(0.0f, -200.0f));
        }
        if (Direction7.Equals(6))
        {
            Rb7.AddForce(V * new Vector2(141.42f, -141.42f));
        }
        if (Direction7.Equals(7))
        {
            Rb7.AddForce(V * new Vector2(-141.42f, -141.42f));
        }
        if (Direction7.Equals(8))
        {
            Rb7.AddForce(V * new Vector2(-141.42f, 141.42f));
        }
        if (Direction7.Equals(5))
        {
            Rb7.AddForce(V * new Vector2(141.42f, 141.42f));
        }
        if (Direction7.Equals(9))
        {
            Rb7.AddForce(V * new Vector2(178.9869f, 89.24f));
        }
        if (Direction7.Equals(10))
        {
            Rb7.AddForce(V * new Vector2(-178.9869f, 89.24f));
        }
        if (Direction7.Equals(11))
        {
            Rb7.AddForce(V * new Vector2(-178.9869f, -89.24f));
        }
        if (Direction7.Equals(12))
        {
            Rb7.AddForce(V * new Vector2(178.9869f, -89.24f));
        }
        B1.GetComponent <Ball> ().Direction = Direction1;
        B2.GetComponent <Ball> ().Direction = Direction2;
        B3.GetComponent <Ball> ().Direction = Direction3;
        B4.GetComponent <Ball> ().Direction = Direction4;
        B5.GetComponent <Ball> ().Direction = Direction5;
        B6.GetComponent <Ball> ().Direction = Direction6;
        B7.GetComponent <Ball> ().Direction = Direction7;

        other.GetComponent <Rigidbody2D>().Sleep();
    }
예제 #4
0
    void Update()
    {
        if (respondio && waith < 200)
        {
            waith++;
        }
        else
        {
            waith     = 0;
            respondio = false;
        }
        if (planet > 8)
        {
            planet = 1;
        }
        if (A.getAns() && !respondio)
        {
            Debug.Log("A!!!");
            Respuesta = "A";
            isItCorrect();
            respondio = true;
        }
        else if (B.getAns() && !respondio)
        {
            Debug.Log("B¡!!");
            Respuesta = "B";
            isItCorrect();
            respondio = true;
        }
        else if (C.getAns() && !respondio)
        {
            Debug.Log("C¡!!");
            Respuesta = "C";
            isItCorrect();
            respondio = true;
        }

        // preguntas Mercurio
        if (planet == Mer)
        {
            setRespFalse();
            A1.SetActive(true);
            B1.SetActive(true);
            C1.SetActive(true);

            CurrentPos = Mercurio;
            timmer     = 0;

            //saludar
            if (!Boolwait && saludar)
            {
                setAudFalse();
                AuHola.SetActive(true);
                saludar = false;
                Wait(1.2f);
            }
            else if (!Boolwait && pista != 1)
            {
                setAudFalse();
                Au1Pr.SetActive(true);

                //pista
                pista = pista * -1;
                Wait(15);
            }
            if (!Boolwait && pista == 1)
            {
                setAudFalse();
                Au1Pi.SetActive(true);
                pista = pista * -1;
                Wait(8);
            }
            //esperar
        }

        if (planet == Ven)
        {
            setRespFalse();
            A2.SetActive(true);
            B2.SetActive(true);
            C2.SetActive(true);
            CurrentPos = Venus;
            timmer     = 0;

            if (!Boolwait && pista2 != 1)
            {
                //pregunta
                pista2 = pista2 * -1;
                setAudFalse();
                Au2Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista2 == 1)
            {
                //pista
                pista2 = pista2 * -1;
                setAudFalse();
                Au2Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Tie)
        {
            setRespFalse();
            A3.SetActive(true);
            B3.SetActive(true);
            C3.SetActive(true);
            CurrentPos = Tierra;
            timmer     = 0;

            if (!Boolwait && pista3 != 1)
            {
                //pregunta
                pista3 = pista3 * -1;
                setAudFalse();
                Au3Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista3 == 1)
            {
                //pista
                pista3 = pista3 * -1;
                setAudFalse();
                Au3Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Mar)
        {
            setRespFalse();
            A4.SetActive(true);
            B4.SetActive(true);
            C4.SetActive(true);
            CurrentPos = Marte;
            timmer     = 0;

            if (!Boolwait && pista4 != 1)
            {
                //pregunta
                pista4 = pista4 * -1;
                setAudFalse();
                Au4Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista4 == 1)
            {
                //pista
                pista4 = pista4 * -1;
                setAudFalse();
                Au4Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Jup)
        {
            setRespFalse();
            A5.SetActive(true);
            B5.SetActive(true);
            C5.SetActive(true);
            CurrentPos = Jupiter;
            timmer     = 0;

            if (!Boolwait && pista5 != 1)
            {
                //pregunta
                pista5 = pista5 * -1;
                setAudFalse();
                Au5Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista5 == 1)
            {
                //pista
                pista5 = pista5 * -1;
                setAudFalse();
                Au5Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Sat)
        {
            setRespFalse();
            A6.SetActive(true);
            B6.SetActive(true);
            C6.SetActive(true);
            CurrentPos = Saturno;
            timmer     = 0;

            if (!Boolwait && pista6 != 1)
            {
                //pregunta
                pista6 = pista6 * -1;
                setAudFalse();
                Au6Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista6 == 1)
            {
                //pista
                pista6 = pista6 * -1;
                setAudFalse();
                Au6Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Nep)
        {
            setRespFalse();
            A7.SetActive(true);
            B7.SetActive(true);
            C7.SetActive(true);
            CurrentPos = Neptuno;
            timmer     = 0;

            if (!Boolwait && pista7 != 1)
            {
                //pregunta
                pista7 = pista7 * -1;
                setAudFalse();
                Au7Pr.SetActive(true);
                Wait(12);
            }
            if (!Boolwait && pista7 == 1)
            {
                //pista
                pista7 = pista7 * -1;
                setAudFalse();
                Au7Pi.SetActive(true);
                Wait(10);
            }
        }
        if (planet == Ura)
        {
            waitTime = waitTime + tres;
            tres     = 0;
            ganaste.SetActive(true);
            gano       = true;
            CurrentPos = Urano;
            timmer     = 0;

            if (!Boolwait && pista8 != 1)
            {
                //pregunta
                pista8 = pista8 * -1;
                setAudFalse();
                Au8Pr.SetActive(true);
                Wait(4);
            }
            if (!Boolwait && pista8 == 1)
            {
                //pista
                pista8 = pista8 * -1;
                setAudFalse();
                Au8Pi.SetActive(true);
                Wait(4);
            }
        }
        ShoulIWait();
        if (!Boolwait && gano)
        {
            SceneManager.LoadScene("Menu");
        }
        transform.localPosition = Vector3.Lerp(transform.localPosition, CurrentPos.position, 0.1f);
        transform.localRotation = Quaternion.Slerp(transform.localRotation, CurrentPos.rotation, 0.1f);
    }