예제 #1
0
    private void GenerateMatrix()
    {
        // gonna be long
        // initial matrix will have Red in front, White down
        var matrixPositions = GetMatrixPositions();

        foreach (CubeEntry entry in cubes)
        {
            CubeName name = entry.name;
            // find the position
            PositionTriplet position = matrixPositions[name];
            // add to matrix;
            cubeMatrix[position.x][position.y][position.z] = new CubeEntry(entry);
            //Debug.Log(name + ": " + position.ToString());
        }
    }
예제 #2
0
    public bool IsSolved()
    {
        Dictionary <CubeName, PositionTriplet> solverMatrix = GetMatrixPositions();

        for (int i = 0; i < 3; i++)
        {
            for (int j = 0; j < 3; j++)
            {
                for (int k = 0; k < 3; k++)
                {
                    if (i != 1 || j != 1 || k != 1)
                    {
                        CubeName        name    = cubeMatrix[i][j][k].name;
                        PositionTriplet triplet = solverMatrix[name];
                        if (!(triplet.x == i && triplet.y == j && triplet.z == k))
                        {
                            return(false);
                        }
                    }
                }
            }
        }
        return(true);
    }
예제 #3
0
        // ## Button ##
        // This is a handler for the Button event. It is triggered when a cube's
        // face button is either pressed or released. The `pressed` argument
        // is true when you press down and false when you release.
        private void OnButton(Cube cube, bool pressed)
        {
            if (pressed) {
            Log.Debug("Button pressed");
              }
              else {
            Log.Debug("Button released");

            switch (mApp.currentPhase) {
                case (PhaseType.BEATSELECT2):
                    mApp.currentPhase = PhaseType.RAPSTART1;
                    mApp.readyToChangeState = true;
                    if (mApp.sampleMusic.IsPlaying)
                        mApp.sampleMusic.Stop();
                    mApp.mMusic = mApp.sampleMusic;
                    break;
                case (PhaseType.RAPSTART1):
                    mApp.currentPhase = PhaseType.RAPSTART2;
                    mApp.readyToChangeState = true;
                    break;
                case (PhaseType.LYRICS):
                    if (mCubeName == CubeName.MIC) {

                        mApp.currentVerseIndex++;
                        mApp.scores[(int) mApp.currentPlayer] = mApp.scores[(int) mApp.currentPlayer] + 1;
                        if (mApp.currentVerseIndex < mApp.verseLines.Length) {

                           foreach (CubeWrapper wrapper in mApp.mWrappers) {
                              wrapper.mText.setText(mApp.verseLines[mApp.currentVerseIndex]);
                              wrapper.DrawSlide();
                           }
                        }
                        else {
                            mApp.currentPhase = PhaseType.ENDOFRAP;
                            mApp.readyToChangeState = true;
                            if (mApp.mMusic.IsPlaying) mApp.mMusic.Stop();
                        }
                    }

                    else if (mCubeName == CubeName.DIS) {

                        mApp.fxMusic = mApp.Sounds.CreateSound("dis");
                        mApp.fxMusic.Play(1, 1);
                        mCubeName = CubeName.JUSTDISSED;
                        mApp.currentPhase = PhaseType.DOUBLEDIS;
                        mApp.readyToChangeState = true;
                        mApp.ticksWaiting = mApp.ticks + 60;
                        mApp.mMusic.Stop();
                    }
                    break;

                case (PhaseType.DOUBLEDIS):
                    if (mCubeName == CubeName.DIS) {
                        mApp.currentPhase = PhaseType.SCORES;
                        mApp.fxMusic = mApp.Sounds.CreateSound("doubledis");
                        mApp.fxMusic.Play(1, 1);
                        mApp.readyToChangeState = true;
                    }
                    break;

                case (PhaseType.TRIVIA1):
                    if (mCubeName == CubeName.CHALLENGER || mCubeName == CubeName.DEFENDER) {
                        mApp.buzzer = mCubeName;
                        mApp.currentPhase = PhaseType.TRIVIA2;
                        mApp.readyToChangeState = true;
                        mApp.fxMusic = mApp.Sounds.CreateSound("ding");
                        mApp.fxMusic.Play(1,1);
                    }
                    break;

                case (PhaseType.TRIVIA2):
                    if (mCubeName == CubeName.ANSWER) {
                        mApp.currentPhase = PhaseType.TRIVIA3;
                        mApp.readyToChangeState = true;

                    }
                    break;

                case (PhaseType.TRIVIA3):
                    if (mCubeName == CubeName.ANSWER) {
                      if (mApp.buzzer == CubeName.DEFENDER) {

                        mApp.scores[(int)mApp.currentPlayer] = mApp.scores[(int)mApp.currentPlayer] + 1;
                        mApp.currentPhase = PhaseType.RAPSTART1;
                        mApp.readyToChangeState = true;
                      }

                      else if (mApp.buzzer == CubeName.CHALLENGER) {

                        mApp.currentPhase = PhaseType.SCORES;
                        mApp.readyToChangeState = true;
                      }
                    }
                    break;

                case (PhaseType.SCORES):
                    if (mImage == "continue") {
                        mApp.currentPhase = PhaseType.NAMESELECT;
                        mApp.readyToChangeState = true;
                    }
                    break;

                case (PhaseType.ENDOFRAP):
                    if (mImage == "continue") {
                        mApp.currentPhase = PhaseType.SCORES;
                        mApp.readyToChangeState = true;
                    }
                    break;

                default:
                    break;
            }
              }
        }