Esempio n. 1
0
    //public void EnterButton(GameObject button)
    //{
    //    insertedOrder.Add(button);
    //}

    //public void CheckOrder()
    //{
    //    int w = new int();

    //    bool incorrect = new bool();
    //    foreach (GameObject g in insertedOrder)
    //    {
    //        //if (correctOrder.Contains(g))
    //        //{
    //            for (int i = 0; i < correctOrder.Count; i++)
    //            {
    //                if (insertedOrder[i] == correctOrder[i])
    //                {
    //                    Debug.Log("Correct");
    //                    finalOrder.Add(insertedOrder[i]);
    //                    for (int q = 0; q < correctOrder.Count; q++)
    //                    {
    //                        if(finalOrder[i] == correctOrder[i])
    //                        {
    //                            w++;
    //                            if(w == correctOrder.Count)
    //                            {
    //                                Winner();
    //                            }
    //                        }
    //                    }
    //                    //if (correctAmount < correctOrder.Count)
    //                    //{
    //                    //    correctAmount++;
    //                    //}
    //                    Debug.Log(correctAmount);
    //                }
    //                else
    //                {
    //                    incorrect = true;
    //                    break;

    //                }
    //            }
    //        //}


    //    }

    //    if (incorrect)
    //    {
    //        IncorrectAnswer();
    //    }


    //}

    //public void Winner()
    //{
    //    foreach (TriggerdObjects t in toTriggerOnWin)
    //    {
    //        t.TriggerFunctionality();
    //    }
    //    done = true;
    //}

    //void IncorrectAnswer()
    //{
    //    Debug.Log("Incorrect");
    //    insertedOrder.Clear();
    //    finalOrder.Clear();
    //    correctAmount = 0;
    //    Debug.Log(correctAmount);

    //    foreach (TriggerdObjects t in trapsToTriggerOnLose)
    //    {
    //        t.TriggerFunctionality();
    //    }
    //}

    public override void PuzzleTrigger(TriggerdObjects currentObject)
    {
        if (!done)
        {
            if (correctOrder[intyMcIntface] == currentObject.gameObject)
            {
                currentObject.GetComponent <SayButton>().StartCoroutine(currentObject.GetComponent <SayButton>().LightUp(.6F));
                intyMcIntface++;
            }
            else
            {
                foreach (TriggerdObjects t in trapsToTriggerOnLose)
                {
                    t.TriggerFunctionality();
                }
                intyMcIntface = 0;
            }


            if (intyMcIntface == correctOrder.Count)
            {
                StartCoroutine(ShowWhenDone());

                puzzleManager.done = true;
                done = true;
                //foreach (TriggerdObjects t in toTriggerOnWin)
                //{
                //    t.TriggerFunctionality();
                //}
            }
        }
        //IsDone();
    }
Esempio n. 2
0
 public override void PuzzleTrigger(TriggerdObjects currentObject)
 {
     if (currentObject.GetComponent <Lamp>())
     {
         CheckLights(currentObject.puzzlePart);
     }
     else if (currentObject.puzzlePart == 1)
     {
         if (hor == 0)
         {
             arrowHor.transform.Translate(4, 0, 0);
             hor = gridWidth - 1;
         }
         else
         {
             arrowHor.transform.Translate(-1, 0, 0);
             hor -= 1;
         }
     }
     else if (currentObject.puzzlePart == 2)
     {
         TriggerAllLights();
     }
     else if (currentObject.puzzlePart == 3)
     {
         if (hor == gridWidth - 1)
         {
             arrowHor.transform.Translate(-4, 0, 0);
             hor = 0;
         }
         else
         {
             arrowHor.transform.Translate(1, 0, 0);
             hor += 1;
         }
     }
     else if (currentObject.puzzlePart == 4)
     {
         if (ver == gridWidth - 1)
         {
             print(gridWidth);
             arrowVer.transform.Translate(0, -4, 0);
             ver = 0;
         }
         else
         {
             arrowVer.transform.Translate(0, 1, 0);
             ver += 1;
         }
     }
 }