public IEnumerator CreateNextEmotions(float duration, CallBack EmotionsManagerCallback)
    {
        isDrawingCards = true;
        activeEmotions.Clear();
        poolEmotions.Clear();
        poolEmotions.AddRange(primaryEmotions);
        if (!currentTargetEmotionStruct.Equals(null))
        {
            poolEmotions.Remove(currentTargetEmotionStruct);    // Prevent the same emotion being selected more than once in a row
        }
        yield return(new WaitForSeconds(duration));

        RemoveCards();
        ChooseActiveEmotion();
        ChooseEmotions();
        yield return(new WaitForSecondsRealtime(0.4f));

        // Create and draw cards
        for (int i = 0; i < numOfSlots; i++)
        {
            int random = Random.Range(0, activeEmotions.Count);
            EmotionData.EmotionStruct emoData = activeEmotions[random];
            activeEmotions.RemoveAt(random);
            CreateCard(emoData);
            yield return(new WaitForSecondsRealtime(0.4f));
        }
        yield return(new WaitForSecondsRealtime(0.5f));

        isDrawingCards = false;
        EmotionsManagerCallback();
    }
예제 #2
0
    public void ChangeEmotions(DataType.MonsterEmotions emotionToChangeTo)
    {
        EmotionData.EmotionStruct emoStruct = emoDict[emotionToChangeTo];

        spriteRenderer.sprite   = emoStruct.sprite;
        monster.selectedEmotion = emoStruct.emotion;
    }
 private void ChooseActiveEmotion()
 {
     EmotionData.EmotionStruct selectedEmoStruct = poolEmotions.RemoveRandom(); // Randomly select and remove an emotion from pool
     poolEmotions.Add(currentTargetEmotionStruct);                              // Put last emotion back into deck
     currentTargetEmotionStruct = selectedEmoStruct;                            // Select emotion chosen by random
     activeEmotions.Add(selectedEmoStruct);                                     // Add to active emotions deck
 }
    private void ChooseEmotions()
    {
        if (allowOtherMonsterCards)
        {
            poolEmotions.AddRange(secondaryEmotions);
        }

        for (int i = 0; i < numOfSlots - 1; i++)
        {
            EmotionData.EmotionStruct emoStruct = poolEmotions.RemoveRandom();
            activeEmotions.Add(emoStruct);
        }
    }
    public IEnumerator CreateTutorialCards()
    {
        poolEmotions.AddRange(primaryEmotions);

        currentTargetEmotionStruct = poolEmotions[0];
        activeEmotions.Add(poolEmotions[0]);
        activeEmotions.Add(poolEmotions[1]);
        poolEmotions.RemoveAt(0);

        for (int i = 0; i < numOfSlots; i++)
        {
            EmotionData.EmotionStruct emoData = activeEmotions[0];
            activeEmotions.RemoveAt(0);

            CreateCard(emoData);
            yield return(new WaitForSecondsRealtime(0.4f));
        }
    }
    public EmotionCard CreateCard(EmotionData.EmotionStruct emoData)
    {
        EmotionCard card = Instantiate(
            cardPrefab,
            cardSpawn.position,
            Quaternion.identity,
            cardSpawn.parent).GetComponent <EmotionCard> ();

        card.monsterSprite = emoData.sprite;
        card.emotion       = emoData.emotion;
        card.clipOfName    = emoData.clipOfEmotion;
        card.colorOfCard   = emoData.emotionColor;

        cardList.Add(card.gameObject);
        if (cardList.Count > 0)
        {
            cardHand.PutCardInSlot(card, cardList.Count - 1);
        }
        return(card);
    }
예제 #7
0
 void SetupEmotionSprites(EmotionData.EmotionStruct emoStruct)
 {
     emoDict.Add(emoStruct.emotion, emoStruct);
 }