コード例 #1
0
    public IEnumerator playSongCoroutine(string cardTitle, float waitBetweenNotes, float speed)
    {
        songPlaying = true;

        NoteChart noteChart = NoteCharts.getChartByTitle(cardTitle);

        Debug.Log("Song Length: " + noteChart.Count());

        playNoteSensor.RecordPercentage(noteChart.Count());

        foreach (Note n in noteChart.noteChart)
        {
            GenerateNote(n, speed);
            yield return(new WaitForSeconds(waitBetweenNotes));
        }

        while (songPlaying)
        {
            yield return(new WaitForSeconds(0.1f));
        }

        //Do card action
        actionManager.doAction(cardTitle, percentHit);

        //cardManager.gameObject.SetActive(true);
    }
コード例 #2
0
    void playCard(int selectedIndex)
    {
        GameObject selectedCard = null;

        Debug.Log("Playing index" + selectedIndex);
        if (selectedIndex == 0)
        {
            selectedCard = warriorCardInHand;
            DrawWarriorCard();
        }
        else if (selectedIndex == 1)
        {
            selectedCard = mageCardInHand;
            DrawMageCard();
        }
        else if (selectedIndex == 2)
        {
            selectedCard = healerCardInHand;
            DrawHealerCard();
        }

        Destroy(selectedCard);
        UpdateHandPositions();

        CardInfo  info      = selectedCard.GetComponent <CardInfo>();
        NoteChart noteChart = NoteCharts.getChartByTitle(info.cardTitle);


        if (info.characterClass == CharacterClass.Warrior)
        {
            Debug.Log("Picking warrior sounds");
            playNoteSensor.currentSound = playNoteSensor.guitarNote;
        }
        else if (info.characterClass == CharacterClass.Mage)
        {
            Debug.Log("Picking mage sounds");
            playNoteSensor.currentSound = playNoteSensor.bassNote;
        }
        else if (info.characterClass == CharacterClass.Healer)
        {
            Debug.Log("Picking healer sounds");
            playNoteSensor.currentSound = playNoteSensor.fluteNote;
        }
        noteGenerator.playSong(info.cardTitle, 0.25f, 1000.0f);
        gameObject.SetActive(false);
    }