Esempio n. 1
0
 public void OnTriggerEnter(Collider col)
 {
     if (col.gameObject.tag == "Slime" || col.gameObject.tag == "Snake" || col.gameObject.tag == "Boot")
     {
         Lives--;
         if (Lives < 1)
         {
             Heart1.GetComponent <SpriteRenderer>().enabled = false;
             Menu.GetComponent <mainMenuJump>().BringUpMenu();
         }
         else if (Lives < 2)
         {
             Heart2.GetComponent <SpriteRenderer>().enabled = false;
         }
         else if (Lives < 3)
         {
             Heart3.GetComponent <SpriteRenderer>().enabled = false;
         }
     }
 }
Esempio n. 2
0
 public void OnTriggerEnter(Collider col)
 {
     if (col.tag == "Obstacle" || col.tag == "Bomb")
     {
         Lives--;
         this.gameObject.GetComponent <AudioSource>().Play();
         if (Lives < 1)
         {
             Heart1.GetComponent <SpriteRenderer>().enabled = false;
             Menu.GetComponent <mainMenuJump>().BringUpMenu();
         }
         else if (Lives < 2)
         {
             Heart2.GetComponent <SpriteRenderer>().enabled = false;
         }
         else if (Lives < 3)
         {
             Heart3.GetComponent <SpriteRenderer>().enabled = false;
         }
     }
 }
Esempio n. 3
0
 void OnCollisionEnter2D(Collision2D col)
 {
     if (col.gameObject.tag == "Slime" || col.gameObject.tag == "Boot" || col.gameObject.tag == "Snake")
     {
         audioSource      = GetComponent <AudioSource>();
         audioSource.clip = sound;
         audioSource.Play();
         Lives--;
         if (Lives < 1)
         {
             Heart1.GetComponent <SpriteRenderer>().enabled = false;
             Menu.GetComponent <mainMenuJump>().BringUpMenu();
         }
         else if (Lives < 2)
         {
             Heart2.GetComponent <SpriteRenderer>().enabled = false;
         }
         else if (Lives < 3)
         {
             Heart3.GetComponent <SpriteRenderer>().enabled = false;
         }
     }
 }
Esempio n. 4
0
    public void SwitchChoice(int x)
    {
        if (x == 10)                                                                       //Enter
        {
            if (chosenNumber.Count > 0 && chosenSymbol.Count > 0 && chosenColor.Count > 0) //make sure they arent empty
            {
                //  print(conversion(chosenColor.ElementAt(0)));
                // print(conversionSymbol(chosenSymbol.ElementAt(0)));
                if ((chosenNumber.ElementAt(0)).ToString() == God.number && conversion(chosenColor.ElementAt(0)) == God.color && conversionSymbol(chosenSymbol.ElementAt(0)) == God.symbol)
                {
                    WinnerMenu.GetComponent <jumpToBoss>().BringUpMenu();
                }
                else
                {
                    Lives--;
                    if (Lives < 1)
                    {
                        GameObject.Find("Directional Light").GetComponent <AudioSource>().Play();
                        Heart1.GetComponent <SpriteRenderer>().enabled = false;
                        Menu.GetComponent <mainMenuJump>().BringUpMenu();
                        return;
                    }
                    else if (Lives < 2)
                    {
                        GameObject.Find("Directional Light").GetComponent <AudioSource>().Play();
                        Heart2.GetComponent <SpriteRenderer>().enabled = false;
                        return;
                    }
                    else if (Lives < 3)
                    {
                        GameObject.Find("Directional Light").GetComponent <AudioSource>().Play();
                        Heart3.GetComponent <SpriteRenderer>().enabled = false;
                        return;
                    }
                }
            }
            else
            {
                // print("retuned");
                return;
            }
            GameObject.Find("ChosenOnes").GetComponent <AudioSource>().Play();

            /*
             * if(chosenNumber.Count > 0)
             * {
             *  chosenNumber.RemoveAt(chosenNumber.Count - 1);
             * }
             * if(chosenSymbol.Count > 0)
             * {
             *  chosenSymbol.RemoveAt(chosenSymbol.Count - 1);
             * }
             * if(chosenColor.Count > 0)
             * {
             *  chosenColor.RemoveAt(chosenColor.Count - 1);
             * }
             */
        }
        else if (x < 3) //Left Column
        {
            for (int i = 0; i < 3; i++)
            {
                pressed.ElementAt(i).GetComponent <SpriteRenderer>().enabled = false;
                if (chosenNumber.Count > 0)
                {
                    chosenNumber.RemoveAt(chosenNumber.Count - 1);
                }
            }
            pressed.ElementAt(x).GetComponent <SpriteRenderer>().enabled = true;
            chosenNumber.Add(x);
        }
        else if (x >= 3 && x <= 5) //Middle Column
        {
            for (int i = 3; i <= 5; i++)
            {
                pressed.ElementAt(i).GetComponent <SpriteRenderer>().enabled = false;
                if (chosenSymbol.Count > 0)
                {
                    chosenSymbol.RemoveAt(chosenSymbol.Count - 1);
                }
            }
            pressed.ElementAt(x).GetComponent <SpriteRenderer>().enabled = true;
            chosenSymbol.Add(x);
        }
        else
        {
            for (int i = 6; i < 9; i++) //Right Column
            {
                pressed.ElementAt(i).GetComponent <SpriteRenderer>().enabled = false;
                if (chosenColor.Count > 0)
                {
                    chosenColor.RemoveAt(chosenColor.Count - 1);
                }
            }
            pressed.ElementAt(x).GetComponent <SpriteRenderer>().enabled = true;
            chosenColor.Add(x);
        }
    }