Exemple #1
0
 public void RemoveCard(UI_Card card)
 {
     if (!mCardsInSlots.Contains(card))
     {
         return;
     }
     mCardsInSlots.Remove(card);
     UpdateDeck();
 }
Exemple #2
0
    //----------------------------Public Functions-----------------------------

    public UI_Card SpawnLooseCardAt(UI_Card card, Vector3 pos)
    {
        var obj = Instantiate(card.gameObject) as GameObject;

        obj.transform.SetParent(this.transform);
        obj.transform.SetAsLastSibling();
        obj.transform.position = pos;
        obj.GetComponent <UI_Card>().SetDeck(this);
        return(obj.GetComponent <UI_Card>());
    }
Exemple #3
0
 public void AddCard(UI_Card card)
 {
     if (mCardsInSlots.Count >= Slots.Count)
     {
         return;
     }
     if (mCardsInSlots.Contains(card))
     {
         return;
     }
     mCardsInSlots.Add(card);
     card.SetDeck(this);
     UpdateDeck();
 }
Exemple #4
0
    // Start is called before the first frame update
    void Start()
    {
        //Gather game Elements
        _gameManager   = GameObject.Find("GameManager").GetComponent <GameManager>();
        ui             = GameObject.Find("UI").GetComponent <UI_Card>();
        _playerAbyss   = GameObject.Find("PAbyss").GetComponent <BoxCollider2D>();
        _opponentAbyss = GameObject.Find("EAbyss").GetComponent <BoxCollider2D>();
        _cardchoice    = GameObject.Find("CardChoice");

        _cardchoice.SetActive(false);

        //Load Decks
        InstantiateDeck(_gameManager.player1Data.PlayerDeck, _playerDeck);
        InstantiateDeck(_gameManager.localWorldData.currentEnnemyDeck, _enemyDeck);
        InstantiateDeck(_gameManager.localWorldData.currentRiverDeck, _riverDeck);

        //Shuffle Decks
        _playerDeck = Shuffle(_playerDeck);
        _enemyDeck  = Shuffle(_enemyDeck);

        //Display Life Points
        _lpPlayer = _playerDeck.Count;
        ui.UpdatePlayerLp(_lpPlayer);

        _lpOpponent = _enemyDeck.Count;
        ui.UpdateEnemyLp(_lpOpponent);

        //Determine rewards
        int rand1Reward = Random.Range(0, _enemyDeck.Count);

        card1_to_win = _enemyDeck[rand1Reward];
        int rand2Reward = Random.Range(0, _enemyDeck.Count);

        card2_to_win = _enemyDeck[rand2Reward];
        int rand3Reward = Random.Range(0, _enemyDeck.Count);

        card3_to_win = _enemyDeck[rand3Reward];

        //Start a turn
        StartCoroutine(Turn());
    }
Exemple #5
0
    public UI_Card AddCardAtIndex(UI_Card card, int index)
    {
        if (mCardsInSlots.Contains(card))
        {
            return(null);
        }

        UI_Card cardCurrentlyAtIndex = null;

        if (index < mCardsInSlots.Count)
        {
            cardCurrentlyAtIndex = mCardsInSlots[index];
            RemoveCard(cardCurrentlyAtIndex);
            mCardsInSlots.Insert(index, card);
            card.SetDeck(this);
        }
        else
        {
            AddCard(card);
        }
        UpdateDeck();

        return(cardCurrentlyAtIndex);
    }