Example #1
0
    /// <summary>
    /// Determines whether this instance is ready to join zone the specified target.
    /// </summary>
    /// <returns><c>true</c> if this instance is ready to join zone the specified target; otherwise, <c>false</c>.</returns>
    /// <param name="target">Target.</param>
    public bool IsReadyToJoinZone(CardDataProperties target, bool IsTargetBiggerThan = false, bool IsSameColor = true)
    {
        if (IsTargetBiggerThan)
        {
            // TODO: Check if this card has the value smaller than target and has the same card type.
            if (properties.GetCardValue() == target.GetCardValue() + 1)
            {
                if (!IsSameColor)
                {
                    if (!IsSameColorCard(target.GetCardType()))
                    {
                        return(true);
                    }
                }
                else
                {
                    if (properties.GetCardType() == target.GetCardType())
                    {
                        // TODO: Return true if this condition is true.
                        return(true);
                    }
                }
            }
        }
        else
        {
            // TODO: Check if this card has the value smaller than target and has the same card type.
            if (properties.GetCardValue() == target.GetCardValue() - 1)
            {
                if (!IsSameColor)
                {
                    if (!IsSameColorCard(target.GetCardType()))
                    {
                        return(true);
                    }
                }
                else
                {
                    if (properties.GetCardType() == target.GetCardType())
                    {
                        // TODO: Return true if this condition is true.
                        return(true);
                    }
                }
            }
        }

        // TODO: Return false.
        return(false);
    }
Example #2
0
    /// <summary>
    /// Inits the card.
    /// </summary>
    /// <param name="card">Card.</param>
    /// <param name="data">Data.</param>
    /// <param name="cardOnBoard">Card on board.</param>
    protected bool InitCard(CardBehaviour card, CardDataProperties data)
    {
        GameObject param = Instantiate(card.gameObject) as GameObject;

        if (param.GetComponent <CardBehaviour> () != null)
        {
            CardBehaviour paramBehaviour = param.GetComponent <CardBehaviour> ();

            paramBehaviour.Init(data);

            PoolSystem.Instance.ReturnToPool(paramBehaviour);

            return(true);
        }
        else
        {
            Destroy(param);
        }

        return(false);
    }
Example #3
0
 /// <summary>
 /// Init the specified data.
 /// </summary>
 /// <param name="data">Data.</param>
 public void Init(CardDataProperties data)
 {
     properties = data;
 }