Ejemplo n.º 1
0
    private GameCardController GenerateCard(Card c)
    {
        GameCardController gameCardController = m_PoolingController.CreateCard(c);

        gameCardController.Init(c.CardImage);
        return(gameCardController);
    }
Ejemplo n.º 2
0
    private void Reuse()
    {
        GameObject         GO = m_UsedObjects.Dequeue();
        GameCardController gameCardController = GO.GetComponent <GameCardController>();

        gameCardController.Reset();
        m_Pool.Enqueue(GO);
    }
Ejemplo n.º 3
0
    public GameCardController CreateCard(Card c)
    {
        GameObject         GO = m_Pool.Dequeue();
        GameCardController gameCardController = GO.GetComponent <GameCardController>();

        m_UsedObjects.Enqueue(GO);
        if (m_Pool.Count == m_MinPoolObjectAmount)
        {
            Reuse();
        }
        return(gameCardController);
    }
Ejemplo n.º 4
0
    /// <summary>
    /// drawing a card from players deck
    /// </summary>
    /// <returns>top card of the player</returns>
    public Card DrawCard(GameManager.EDrawType drawType, UnityAction OnDrawCompleted = null)
    {
        if (Deck.Count == 0)
        {
            GameState = EPlayerGameState.lost;
            OnDeckEmpty.Invoke();
        }
        Card c = Deck.Dequeue();
        GameCardController gameCardController = GenerateCard(c);

        gameCardController.DrawCard(drawType, OnDrawCompleted);
        m_ActiveGameCards.Add(gameCardController);
        return(c);
    }