// Use this for initialization
    void Start()
    {
        p1HandHigh   = false;
        p1HandLow    = false;
        p1Forward    = false;
        p1Back       = false;
        p2HandHigh   = false;
        p2HandLow    = false;
        p2Forward    = false;
        p2Back       = false;
        socialInter1 = false;
        highSession  = false;
        lowSession   = false;

        waitingForInput = false;

        GetTextObjects();

        player1Input = player1InputObject.GetComponent <UserInput>();
        player2Input = player2InputObject.GetComponent <UserInput>();

        audio1 = audioPlayer1.GetComponent <toneHolder>();
        audio2 = audioPlayer2.GetComponent <toneHolder>();

        tutorialStarted = false;
        pauseTime       = false;
        tutorialTimer   = 0;


        StartCoroutine(DisplayTutorialText());
    }
Example #2
0
    void GetToneSets()
    {
        melodicSetAmount = melodicObject.transform.childCount;
        rythmSetAmount   = rythmObject.transform.childCount;

        melodicSets = new toneHolder[melodicSetAmount];
        rythmSets   = new toneHolder[rythmSetAmount];

        for (int i = 0; i < melodicSetAmount; i++)
        {
            melodicSets[i] = melodicObject.transform.GetChild(i).gameObject.GetComponent <toneHolder>();
        }
        for (int i = 0; i < rythmSetAmount; i++)
        {
            rythmSets[i] = rythmObject.transform.GetChild(i).gameObject.GetComponent <toneHolder>();
        }
    }
Example #3
0
    void InitializeToneSets(GameObject tonesetObject, GameObject rythmObject, GameObject bassObject)
    {
        toneSetAmount      = tonesetObject.transform.childCount;
        rythmToneSetAmount = rythmObject.transform.childCount;

        melodicToneSet = new toneHolder[toneSetAmount];
        rythmToneSet   = new toneHolder[rythmToneSetAmount];

        for (int i = 0; i < toneSetAmount; i++)
        {
            melodicToneSet[i] = tonesetObject.transform.GetChild(i).gameObject.GetComponent <toneHolder>();
        }

        for (int i = 0; i < rythmToneSetAmount; i++)
        {
            rythmToneSet[i] = rythmObject.transform.GetChild(i).gameObject.GetComponent <toneHolder>();
        }
    }
Example #4
0
    public void PlayerIO(UserInput playerInput, toneHolder[] toneSet, int toneSetAmount, ref int tonePos, ref bool isPlayable)
    {
        AudioClip high, mid, low;

        //Debug.Log("Looking for input " + playerInput.userInput);

        bool isRythmPlayer = false;

        if (player2rythm && playerInput.name == p2name)
        {
            isRythmPlayer = true;
        }
        else if (!player2rythm && playerInput.name != p2name)
        {
            isRythmPlayer = true;
        }

        if (usingToneMatch)
        {
            InputMatcher();
        }

        if (tonePos >= toneSetAmount)
        {
            tonePos = 0;
        }


        if (playerInput.userInput == lastPlayed)
        {
            if (lastPlayed == playerInput.inputHigh)
            {
                tonePos = toneSet[tonePos].tonesetRefHigh;
            }
            else if (lastPlayed == playerInput.inputLow)
            {
                tonePos = toneSet[tonePos].tonesetRefLow;
            }
        }


        toneHolder currentToneSet = toneSet[tonePos];

        //Debug.Log("TonePos = " + tonePos);

        high = currentToneSet.high;
        mid  = currentToneSet.mid;
        low  = currentToneSet.low;



        if (playerInput.inputHigh == "" && playerInput.inputMid == "" && playerInput.inputLow == "")
        {
            //Debug.LogError("Assign input controls");
        }
        else
        {
            if (playerInput.userInput == playerInput.inputHigh && isPlayable == true)
            {
                isPlayable = false;

                playerInput.audioSource.PlayOneShot(high);
                mainTrackTimer = 0;
                ActivateDrums();


                playerInput.userInput = null;
                lastPlayed            = "high";

                if (tonePos == 0)
                {
                    tonePos = toneSet[tonePos].tonesetRefHigh;
                }
            }

            else if (playerInput.userInput == playerInput.inputMid && isPlayable == true && useMidInput == true)
            {
                playerInput.audioSource.PlayOneShot(mid);
                mainTrackTimer = 0;
                ActivateDrums();

                isPlayable = false;



                playerInput.userInput = null;
            }

            else if (playerInput.userInput == playerInput.inputLow && isPlayable == true)
            {
                playerInput.audioSource.PlayOneShot(low);
                mainTrackTimer = 0;
                ActivateDrums();

                isPlayable = false;



                playerInput.userInput = null;
                lastPlayed            = "low";
                if (tonePos == 0)
                {
                    tonePos = toneSet[tonePos].tonesetRefLow;
                }
                //tonePos = currentToneSet.tonesetRefLow;
            }
        }
    }