예제 #1
0
    public void Init()
    {
        // Erase the actual deck
        gameDeck = new List <CardData.Settings>();
        // Add all card we got from server
        for (int i = 0; i < cardDownloader.gameDeck.cards.Length; i++)
        {
            CardData.Settings newCard = new CardData.Settings();
            newCard.characterName = cardDownloader.gameDeck.cards [i].person;
//			Debug.Log (newCard.characterName);
            newCard.cardText = cardDownloader.gameDeck.cards [i].title;
//			newCard.cradImage = cardDownloader.gameDeck.cards [i].url_image;

            for (int j = 0; j < cardDownloader.gameDeck.cards[i].answers.Length; j++)
            {
                CardData.Outcome outcome = new CardData.Outcome();
                for (int k = 0; k < cardDownloader.gameDeck.cards[i].answers[j].points.Length; k++)
                {
                    // Store answer's description
                    outcome.description = cardDownloader.gameDeck.cards[i].answers[j].text;
                    // We must manually detect each point type to store
                    //Debug.Log("Value" + cardDownloader.gameDeck.cards [i].answers [j].points [k].value);
                    switch (cardDownloader.gameDeck.cards[i].answers[j].points[k].slug)
                    {
                    case "fun":
                        outcome.fun = cardDownloader.gameDeck.cards [i].answers [j].points [k].value;
                        break;

                    case "love":
                        outcome.love = cardDownloader.gameDeck.cards [i].answers [j].points [k].value;
                        break;

                    case "money":
                        outcome.money = cardDownloader.gameDeck.cards [i].answers [j].points [k].value;
                        break;

                    case "health":
                        outcome.health = cardDownloader.gameDeck.cards [i].answers [j].points [k].value;
                        break;
                    }
                }
                // Add this outcome to the right swipe
                if (cardDownloader.gameDeck.cards [i].answers [j].type.ToLower() == "right")
                {
                    newCard.rightOutcome = outcome;
                }
                else
                {
                    newCard.leftOutcome = outcome;
                }
            }
            // Get the probability data
            CardData.Chances chances = new CardData.Chances();
            newCard.chances = chances;
            //-------------------------------------------
            // Add this card to the list
            gameDeck.Add(newCard);
        }
        InitParameters();
    }
예제 #2
0
    //===============================================================================================================================================================================
    //===============================================================================================================================================================================
    //=====  ACTION PLAY FUNCTIONS
    public void ComputeSwipeOutcome(CardData.Outcome outcome)
    {
        // Apply the outcome
        familyLevel += outcome.fun;
        loveLevel   += outcome.love;
        moneyLevel  += outcome.money;
        healthLevel += outcome.health;
        // Pass the time
        _yearsPassed++;
//		BuildPool ();

        if (_SOLO_TEST)
        {
            DrawCard();
        }
    }
예제 #3
0
    void OnCardSwiped(CardMovement swipedCard)
    {
        CardData.Outcome outcome = swipedCard.GetSwipeOutcome();
        cardManager.ComputeSwipeOutcome(outcome);
        FillParametersDisplay();
        DisplayPlayerData();
        ResetSelectors();

        CardData.Settings card = cardManager.PickCard();

        CardMovement   nextCard   = (swipedCard == cardGOs [0]) ? cardGOs [1] : cardGOs [0];
        GameOverReason overReason = CheckGameOver(nextCard);

        if (overReason == GameOverReason.Alive)
        {
            swipedCard.SetCardData(card);
            DisplayCardData(nextCard);
        }
        else
        {
            GameOver.SetupGameOver(overReason, cardManager._initialAge + cardManager._yearsPassed);
            Scenes.LoadScene(Scenes.GameOver);
        }
    }
예제 #4
0
 public CardData.Outcome GetSwipeOutcome()
 {
     CardData.Outcome outcome = (this.swipeDirection == SwipeDirection.Left) ? this.cardData.leftOutcome : this.cardData.rightOutcome;
     return(outcome);
 }