Exemple #1
0
    private void OnEnable()
    {
        hasPicked = false;
        objects   = new GameObject[3];
        for (int i = 0; i < 3; i++)
        {
            CardAction cardAction = new CardAction();
            cardAction.Data   = cardActions[Random.Range(0, cardActions.Length)];
            cardAction.Source = playerLane.getPlayer();
            objects[i]        = GameManager.InstantiateCardAction(cardAction, "Player");
            objects[i].transform.SetParent(transform);
        }

        int pos = transform.parent.childCount;

        transform.SetSiblingIndex(pos + 1);

        // instantiate random card on c1
        objects[0].transform.position   = c1.transform.position;
        objects[0].transform.localScale = new Vector3(4, 4, 0);
        objects[0].GetComponent <CardUI>().draggable  = false;
        objects[0].GetComponent <CardUI>().selectLink = gameObject;
        // instantiate random card on c2
        objects[1].transform.position   = c2.transform.position;
        objects[1].transform.localScale = new Vector3(4, 4, 0);
        objects[1].GetComponent <CardUI>().draggable  = false;
        objects[1].GetComponent <CardUI>().selectLink = gameObject;
        // instantiate random card on c3
        objects[2].transform.position   = c3.transform.position;
        objects[2].transform.localScale = new Vector3(4, 4, 0);
        objects[2].GetComponent <CardUI>().draggable  = false;
        objects[2].GetComponent <CardUI>().selectLink = gameObject;
    }
Exemple #2
0
    IEnumerator LoadLevel()
    {
        //Play fade
        GameObject fadeObj = intermission.FadeFunc();

        if (!firstLoad)
        {
            fadeObj.GetComponent <Animation>().Play("Fade");
        }
        yield return(new WaitForSeconds(0.5f));

        playerLane.getPlayer().Deck.Shuffle();

        // Select card
        if (!firstLoad)
        {
            selectCardScreen.GetComponent <SelectCard>().enabled = true;
            yield return(new WaitUntil(() => selectCardScreen.GetComponent <SelectCard>().picked()));

            var newCard = selectCardScreen.GetComponent <SelectCard>().returnCard();

            playerLane.getPlayer().Deck.AddCards(new List <CardActionData>()
            {
                newCard
            });
            selectCardScreen.GetComponent <SelectCard>().enabled = false;
        }

        //Exit fade
        if (!firstLoad)
        {
            fadeObj.GetComponent <Animation>().Play("FadeExit");
        }
        yield return(new WaitForSeconds(0.5f));

        Destroy(fadeObj);

        playerLane.getPlayer().ResetDeck();
        for (int i = 0; i < 4; i++)
        {
            var playerActions = playerLane.GetTurnActions();
            ShowPlayerHand(playerActions);
            Debug.Log($"{i}: {playerActions.First()}");
        }

        int index = 0;

        foreach (var i in levels[currentLevel].character)
        {
            if (!levels[currentLevel].character[index])
            {
                break;
            }

            enemyLane.AddCharacter(i, index);
            index++;
        }

        SetupNextTurn(false);

        firstLoad = false;
    }