Пример #1
0
    public void restartBarras()
    {
        randomCachos();
        if (A == 0)
        {
            A1.SetActive(true);
            A2.SetActive(false);
        }
        else
        {
            A1.SetActive(false);
            A2.SetActive(true);
        }

        if (B == 0)
        {
            B1.SetActive(true);
            B2.SetActive(false);
        }
        else
        {
            B1.SetActive(false);
            B2.SetActive(true);
        }
    }
Пример #2
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);
 }
Пример #3
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);
    }
Пример #4
0
    void Reset()
    {
        if (isChange)
        {
            for (int i = 0; i < 4; i++)
            {
                Change [i].color = new Color(0.0f, 0.0f, 0.0f, 0.0f);
            }
        }

        StopCoroutine("Rexar");
        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;
        ChangeColor(0);
    }
Пример #5
0
    void GameStart()
    {
        Minigame.SetActive(false);
        Bumbu1.SetActive(false);
        Bumbu2.SetActive(false);
        telurGoreng.SetActive(false);
        NasiP.SetActive(false);
        NasiG.SetActive(false);

        Panel1 = false;
        Panel2 = false;
        Panel3 = false;
        Panel4 = false;

        score = 0;

        Achieve.value = score;

        startPos = AIoned.transform.position;
        Debug.Log(startPos);

        AI1 = true;
        AI2 = false;
        AI3 = false;
        AI4 = false;

        Time.timeScale = 1;


        if (Level == 1)
        {
            Achieve.maxValue = 45;
            timerF           = 60;
            Hitung           = true;
        }
        if (Level == 2)
        {
            Achieve.maxValue = 60;
            timerF           = 100;
            Hitung           = true;
        }
        if (Level == 3)
        {
            Achieve.maxValue = 100;
            timerF           = 140;
            Hitung           = true;
        }

        Winlose.SetActive(false);
        B0.SetActive(false);
        B1.SetActive(false);
        B2.SetActive(false);
        B3.SetActive(false);

        PauseBG.SetActive(true);
        Pauz.SetActive(false);
    }
Пример #6
0
    // Use this for initialization
    void Start()
    {
        FX = GetComponent <AudioSource> ().clip;
        B1.SetActive(false);
        B2.SetActive(false);
        B3.SetActive(false);
        B4.SetActive(false);
        B5.SetActive(false);
        B6.SetActive(false);

        Bcount = Random.Range(100, 800);
    }
Пример #7
0
 public void Left()
 {
     if (MobileSettings)
     {
         if (n == 5)
         {
             B5.SetActive(false);
             B4.SetActive(true);
             n--;
         }
         else if (n == 4)
         {
             B4.SetActive(false);
             B2.SetActive(true);
             n -= 2;
         }
         else if (n == 2)
         {
             B2.SetActive(false);
             B1.SetActive(true);
             n--;
         }
     }
     else
     {
         if (n == 5)
         {
             B5.SetActive(false);
             B4.SetActive(true);
             n--;
         }
         else if (n == 4)
         {
             B4.SetActive(false);
             B3.SetActive(true);
             n--;
         }
         else if (n == 3)
         {
             B3.SetActive(false);
             B2.SetActive(true);
             n--;
         }
         else if (n == 2)
         {
             B2.SetActive(false);
             B1.SetActive(true);
             n--;
         }
     }
 }
Пример #8
0
 public void Right()
 {
     if (MobileSettings)
     {
         if (n == 1)
         {
             B1.SetActive(false);
             B2.SetActive(true);
             n++;
         }
         else if (n == 2)
         {
             B2.SetActive(false);
             B4.SetActive(true);
             n += 2;
         }
         else if (n == 4)
         {
             B4.SetActive(false);
             B5.SetActive(true);
             n++;
         }
     }
     else
     {
         if (n == 1)
         {
             B1.SetActive(false);
             B2.SetActive(true);
             n++;
         }
         else if (n == 2)
         {
             B2.SetActive(false);
             B3.SetActive(true);
             n++;
         }
         else if (n == 3)
         {
             B3.SetActive(false);
             B4.SetActive(true);
             n++;
         }
         else if (n == 4)
         {
             B4.SetActive(false);
             B5.SetActive(true);
             n++;
         }
     }
 }
Пример #9
0
    //bool A = true;
    //bool C = true;

    // Use this for initialization
    void Awake()
    {
        EffectCircle1.SetActive(false);
        CS1 = EffectCircle1.GetComponent <SpriteRenderer> ();
        CT1 = EffectCircle1.transform;

        Rb1   = B1.GetComponent <Rigidbody2D> ();
        Tra1  = B1.GetComponent <TrailRenderer> ();
        Tra2  = B2.GetComponent <TrailRenderer> ();
        Btr1  = B1.transform;
        Btr2  = B2.transform;
        Pos   = transform.position;
        Scale = transform.localScale.x;
        Rb2   = B2.GetComponent <Rigidbody2D> ();
        B1.SetActive(false);
        B2.SetActive(false);
    }
Пример #10
0
    IEnumerator Reset()
    {
        K = 0;
        Lighting.SetActive(false);
        Wick.SendMessage("Reset");
        B2.layer      = 15;
        Btr1.position = Pos - Scale * new Vector3(2.2f, 0.0f, 0.0f);

        if (OutDirection.Equals(1))
        {
            Btr2.position = Pos + Scale * new Vector3(2.2f, 0.0f, 0.0f);

            //Rb.AddForce (new Vector3 (200.0f, 0, 0));
        }
        else if (OutDirection.Equals(2))
        {
            Btr2.position = Pos + Scale * new Vector3(0.0f, 2.2f, 0.0f);

            ///Rb.AddForce (new Vector2 (0.0f, 200.0f));
        }
        else if (OutDirection.Equals(4))
        {
            Btr2.position = Pos + Scale * new Vector3(0.0f, -2.2f, 0.0f);

            //Rb.AddForce (new Vector2 (0.0f, -200.0f));
        }
        //if (bulbOn) {
        bulbOn    = false;
        Tra1.time = 0.0f;
        Tra2.time = 0.0f;
        Rb1.Sleep();
        Rb2.Sleep();
        yield return(new WaitForSeconds(0.1f));

        B1.SetActive(false);
        B2.SetActive(false);
        for (int i = 0; i < 50; i++)
        {
            SS[i].color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
        }
        First = true;
        //}
    }
Пример #11
0
 void OnTriggerExit2D(Collider2D col)
 {
     if (col.gameObject.Equals(B1) && !First)
     {
         B1.SetActive(false);
         B2.SetActive(true);
         Tra2.time = Mathf.Infinity;
         Lighting.SetActive(true);
         if (OutDirection.Equals(1))
         {
             Rb2.AddForce(V * new Vector2(200.0f, 0.0f));
         }
         else if (OutDirection.Equals(2))
         {
             Rb2.AddForce(V * new Vector2(0.0f, 200.0f));
         }
         else if (OutDirection.Equals(4))
         {
             Rb2.AddForce(V * new Vector2(0.0f, -200.0f));
         }
         StartCoroutine("Effect");
     }
 }
Пример #12
0
    IEnumerator Rexar(int Layer, Collider2D other)
    {
        B1.SetActive(true);
        B1.transform.position = Pos1;
        B1.layer = Layer;
        B1.GetComponent <Ball> ().Direction = Direction1;

        B2.SetActive(true);
        B2.transform.position = Pos2;
        B2.layer = Layer;
        B2.GetComponent <Ball> ().Direction = Direction2;

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

        yield return(new WaitForSeconds(0.1f));

        if (isChange)
        {
            if (Layer.Equals(8))
            {
                //Debug.Log ("AAA");
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
                }
            }
            else if (Layer.Equals(9))
            {
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(230 / 255f, 0.0f, 18 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(10))
            {
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(0.0f, 153 / 255f, 68 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(11))
            {
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(249 / 255f, 230 / 255f, 47 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(12))
            {
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(0.0f, 71 / 255f, 157 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(13))
            {
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(228 / 255f, 0.0f, 180 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(14))
            {
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(0.0f, 160 / 255f, 233 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(15))
            {
                for (int i = 0; i < 3; i++)
                {
                    Change [i].color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
                }
            }
        }

        Direction();
        other.GetComponent <Rigidbody2D>().Sleep();
    }
Пример #13
0
    void Update()
    {
        Achieve.value = score;

        if (Level == 1 && play == true)
        {
            if (Hitung == true)
            {
                timerF -= Time.deltaTime;
            }

            timer.text = "" + timerF.ToString("f0");

            if (score >= 45)
            {
                if (timerF >= 20)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B3.SetActive(true);
                    Hitung = false;
                    Debug.Log("You win");
                    ClearAI();
                    ClearAll();
                    Time.timeScale = 0;
                    bintang        = 3;
                }
                else if (timerF < 20)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B2.SetActive(true);
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang        = 2;
                }
            }
            else if (timerF <= 0)
            {
                if (score > 15)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B1.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang        = 1;
                }
                else
                {
                    play = false;
                    Winlose.SetActive(true);
                    B0.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang        = 0;
                }
            }
        }

        if (Level == 2 && play == true)
        {
            if (Hitung == true)
            {
                timerF -= Time.deltaTime;
            }

            timer.text = "" + timerF.ToString("f0");

            if (score >= 60)
            {
                if (timerF >= 30)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B3.SetActive(true);
                    Hitung = false;
                    Debug.Log("You win");
                    ClearAI();
                    ClearAll();
                    Time.timeScale = 0;
                    bintang2       = 3;
                }
                else if (timerF < 30)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B2.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang2       = 2;
                }
            }
            else if (timerF <= 0)
            {
                if (score > 20)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B1.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang2       = 1;
                }
                else
                {
                    play = false;
                    Winlose.SetActive(true);
                    B0.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang2       = 0;
                }
            }
        }

        if (Level == 3 && play == true)
        {
            if (Hitung == true)
            {
                timerF -= Time.deltaTime;
            }

            timer.text = "" + timerF.ToString("f0");

            if (score >= 100)
            {
                if (timerF >= 40)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B3.SetActive(true);
                    Hitung = false;
                    Debug.Log("You win");
                    ClearAI();
                    ClearAll();
                    Time.timeScale = 0;
                    bintang3       = 3;
                }
                else if (timerF < 40)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B2.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang3       = 2;
                }
            }
            else if (timerF <= 0)
            {
                if (score > 40)
                {
                    play = false;
                    Winlose.SetActive(true);
                    B1.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang3       = 1;
                }
                else
                {
                    play = false;
                    Winlose.SetActive(true);
                    B0.SetActive(true);
                    ClearAI();
                    Hitung = false;
                    ClearAll();
                    Debug.Log("You win");
                    Time.timeScale = 0;
                    bintang3       = 0;
                }
            }
        }

        AIoned.SetActive(AI1);
        AItwod.SetActive(AI2);
        AIthreed.SetActive(AI3);
        AIfoured.SetActive(AI4);
        Waving();
    }
Пример #14
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;
        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;
        Tr1.position = Pos1;
        Tr2.position = Pos2;
        Tr3.position = Pos3;
        Tr4.position = Pos4;
        Tr5.position = Pos5;



        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));
        }
        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;
        other.GetComponent <Rigidbody2D>().Sleep();
    }
Пример #15
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);
    }
Пример #16
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;

        yield return(new WaitForSeconds(0.1f));

        if (isChange)
        {
            if (Layer.Equals(8))
            {
                //Debug.Log ("AAA");
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 0.0f, 0.0f, 1.0f);
                }
            }
            else if (Layer.Equals(9))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(230 / 255f, 0.0f, 18 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(10))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 153 / 255f, 68 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(11))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(249 / 255f, 230 / 255f, 47 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(12))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 71 / 255f, 157 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(13))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(228 / 255f, 0.0f, 180 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(14))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(0.0f, 160 / 255f, 233 / 255f, 1.0f);
                }
            }
            else if (Layer.Equals(15))
            {
                for (int i = 0; i < 4; i++)
                {
                    Change [i].color = new Color(1.0f, 1.0f, 1.0f, 1.0f);
                }
            }
        }

        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;
        Tr1.position = Pos1;
        Tr2.position = Pos2;
        Tr3.position = Pos3;
        Tr4.position = Pos4;


        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 (Direction1.Equals(13))
        {
            Rb1.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr1.position = Pos1;
        }
        if (Direction1.Equals(14))
        {
            Rb1.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr1.position = Pos1;
        }
        if (Direction1.Equals(15))
        {
            Rb1.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr1.position = Pos1;
        }
        if (Direction1.Equals(16))
        {
            Rb1.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr1.position = Pos1;
        }



        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 (Direction2.Equals(13))
        {
            Rb2.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr2.position = Pos2;
        }
        if (Direction2.Equals(14))
        {
            Rb2.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr2.position = Pos2;
        }
        if (Direction2.Equals(15))
        {
            Rb2.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr2.position = Pos2;
        }
        if (Direction2.Equals(16))
        {
            Rb2.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr2.position = Pos2;
        }


        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 (Direction3.Equals(13))
        {
            Rb3.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr3.position = Pos3;
        }
        if (Direction3.Equals(14))
        {
            Rb3.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr3.position = Pos3;
        }
        if (Direction3.Equals(15))
        {
            Rb3.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr3.position = Pos3;
        }
        if (Direction3.Equals(16))
        {
            Rb3.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr3.position = Pos3;
        }


        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 (Direction4.Equals(13))
        {
            Rb4.AddForce(V * new Vector2(89.24f, 178.9869f));
            Tr4.position = Pos4;
        }
        if (Direction4.Equals(14))
        {
            Rb4.AddForce(V * new Vector2(-89.24f, 178.9869f));
            Tr4.position = Pos4;
        }
        if (Direction4.Equals(15))
        {
            Rb4.AddForce(V * new Vector2(-89.24f, -178.9869f));
            Tr4.position = Pos4;
        }
        if (Direction4.Equals(16))
        {
            Rb4.AddForce(V * new Vector2(89.24f, -178.9869f));
            Tr4.position = Pos4;
        }
        B1.GetComponent <Ball> ().Direction = Direction1;
        B2.GetComponent <Ball> ().Direction = Direction2;
        B3.GetComponent <Ball> ().Direction = Direction3;
        B4.GetComponent <Ball> ().Direction = Direction4;
        other.GetComponent <Rigidbody2D>().Sleep();
    }