예제 #1
0
    // Update is called once per frame
    void Update()
    {
        //---------
        //Over here an example of the preferred use of the UI feedback:
        //When a shape is correct
        if (Input.GetKeyDown(KeyCode.U))
        {
        }

        //When a shape is Wrong
        if (Input.GetKeyDown(KeyCode.I))
        {
        }

        //When a shape is shifting
        if (Input.GetKeyDown(KeyCode.O))
        {
            //Maybe add bonus points when a shape is complete?
        }
        //---------

        //Play selection sound on keydown
        if (!_isBlocked)
        {
            //if (Input.anyKeyDown)
            //{
            //    SoundManager.PlaySound("Selection");
            //}

            //Add number to inputted array if it isn't full yet
            if (ArrayInputed.Count <= NumbersToGuess)
            {
                if (Input.GetKeyDown(KeyCode.Q))
                {
                    ArrayInputed.Add(0);
                    Check(KeyCode.Q);
                }
                if (Input.GetKeyDown(KeyCode.W))
                {
                    ArrayInputed.Add(1);
                    Check(KeyCode.W);
                }
                if (Input.GetKeyDown(KeyCode.E))
                {
                    ArrayInputed.Add(2);
                    Check(KeyCode.E);
                }
                if (Input.GetKeyDown(KeyCode.R))
                {
                    ArrayInputed.Add(3);
                    Check(KeyCode.R);
                }
                if (Input.GetKeyDown(KeyCode.T))
                {
                    ArrayInputed.Add(4);
                    Check(KeyCode.T);
                }
                if (Input.GetKeyDown(KeyCode.Y))
                {
                    ArrayInputed.Add(5);
                    Check(KeyCode.Y);
                }
            }

            //Remove from inputted array on keyup
            if (Input.GetKeyUp(KeyCode.Q))
            {
                ArrayInputed.Remove(0);
                Check(KeyCode.Q);
            }
            if (Input.GetKeyUp(KeyCode.W))
            {
                ArrayInputed.Remove(1);
                Check(KeyCode.W);
            }
            if (Input.GetKeyUp(KeyCode.E))
            {
                ArrayInputed.Remove(2);
                Check(KeyCode.E);
            }
            if (Input.GetKeyUp(KeyCode.R))
            {
                ArrayInputed.Remove(3);
                Check(KeyCode.R);
            }
            if (Input.GetKeyUp(KeyCode.T))
            {
                ArrayInputed.Remove(4);
                Check(KeyCode.T);
            }
            if (Input.GetKeyUp(KeyCode.Y))
            {
                ArrayInputed.Remove(5);
                Check(KeyCode.Y);
            }
        }
        if (PreviewPie)
        {
            //Activate previewpie UI and start charging on buttonpress

            for (int i = 0; i < MaxElements; i++)
            {
                if (ArrayInputed.Contains(i))
                {
                    PreviewPie.ActivatePiece(i);
                }
                else
                {
                    PreviewPie.DeactivatePiece(i);
                }
            }
        }

        /*if (ArrayInputed.Count == 0)
         * {
         *  PreviewPie.TurnOffAll();
         * }*/
        //Check for solution


        //Update UI Score
    }
예제 #2
0
    public void GenerateSequenece()
    {
        Debug.Log(_currentPart + " currpart");
        List <int> generated = new List <int>();

        foreach (var face in _sequence[_currentPart])
        {
            int high = High[Stage];
            if (_sequence.Count > 1)
            {
                high = MaxCombo[Stage];
            }
            for (int i = 0; i < Random.Range(Low[Stage], high); i++)
            {
                int rnd = Random.Range(0, MaxElements);

                while (generated.Contains(rnd))
                {
                    rnd = Random.Range(0, MaxElements);
                }
                generated.Add(rnd);
                DebugPie.ActivatePiece(rnd);
                ArrayToGuess.Add(rnd);
                face.ActivatePiece(rnd);
                Debug.Log(rnd);
            }
        }
        string outer = "";

        foreach (var num in ArrayToGuess)
        {
            outer += num.ToString();
        }
        Debug.Log(outer + " SEQUENCE");
        //Debug.Log("generAting");
        //for (int i = 0; i < NumbersToGuess; i++)
        //{
        //    int rnd = Random.Range(0, MaxElements);
        //    while (ArrayToGuess.Contains(rnd))
        //    {
        //        rnd = Random.Range(0, MaxElements);

        //    }

        //    ArrayToGuess.Add(rnd);

        //}



        //if (ModeSubstract)
        //{
        //    foreach (var item in ArrayToGuess)
        //    {
        //        print(item);
        //        DebugPie.ActivatePiece(item);
        //    }
        //    int rnd = Random.Range(2, MaxElements);
        //    List<int> temp = new List<int>();
        //    for (int i = 0; i < rnd; i++)
        //    {
        //        if (ArrayToGuess.Count > i)
        //        {
        //            temp.Add(ArrayToGuess[i]);
        //            ActivatePlayerFaces(ObjectPlayerOne, ArrayToGuess[i]);
        //        }
        //        else
        //        {
        //            int r = Random.Range(0, MaxElements);
        //            temp.Add(r);
        //            ActivatePlayerFaces(ObjectPlayerOne, r);
        //        }
        //    }


        //    var firstNotSecond = ArrayToGuess.Except(temp).ToList();
        //    var secondNotFirst = temp.Except(ArrayToGuess).ToList();
        //    foreach (var num in secondNotFirst)
        //    {
        //        ActivatePlayerFaces(ObjectPlayerTwo, num);

        //    }
        //    string first = "";
        //    string second = "";
        //    foreach (var num in firstNotSecond)
        //    {

        //        first += num.ToString();

        //    }
        //    foreach (var num in secondNotFirst)
        //    {

        //        second += num.ToString();

        //    }
        //    Debug.Log("first: " + first + "\nsecond: " + second);

        //}
        //else
        //{
        //    foreach (var item in ArrayToGuess)
        //    {
        //        print(item);
        //        DebugPie.ActivatePiece(item);
        //        if (EachPlayerGetsPiece)
        //        {
        //            if (ObjectPlayerOne.IsActive == ObjectPlayerTwo.IsActive)
        //            {
        //                if (Random.Range(0, 2) == 0)
        //                {
        //                    ActivatePlayerFaces(ObjectPlayerOne, item);
        //                }
        //                else
        //                {
        //                    ActivatePlayerFaces(ObjectPlayerTwo, item);


        //                }
        //            }
        //            else if (!ObjectPlayerOne.IsActive)
        //            {
        //                ActivatePlayerFaces(ObjectPlayerOne, item);

        //            }
        //            else if (!ObjectPlayerTwo.IsActive)
        //            {
        //                ActivatePlayerFaces(ObjectPlayerTwo, item);

        //            }
        //        }
        //        else
        //        {
        //            if (Random.Range(0, 2) == 0)
        //            {
        //                ActivatePlayerFaces(ObjectPlayerOne, item);
        //            }
        //            else
        //            {
        //                ActivatePlayerFaces(ObjectPlayerTwo, item);
        //            }



        //        }
        //    }
        //}
    }
예제 #3
0
 public void ActivateFace(PuzzleFace face, int piece)
 {
     face.ActivatePiece(piece);
 }