示例#1
0
    void Awake()
    {
        lastCardIndex       = new cardIndex();
        getCardIndex_result = new cardIndex();

        lastCardIndex.groupIndex   = 0;
        lastCardIndex.cardSubIndex = 0;

        rndCard  = ScriptableObject.CreateInstance(typeof(RandomElementWithPropability)) as RandomElementWithPropability;
        instance = this;
    }
示例#2
0
    bool cardIndexValid(cardIndex ci)
    {
        //test, if index is within allowed range of upper group
        if (ci.groupIndex >= allCards.Length)
        {
            return(false);
        }
        //test, if index is within allowed range of sub group
        if (ci.cardSubIndex >= allCards [ci.groupIndex].groupCards.Length)
        {
            return(false);
        }

        return(true);
    }
示例#3
0
    //spawn a card, set its parameters and count it
    GameObject spawnCard(GameObject go)
    {
        //Debug.Log ("new card");
        spawnedCard = (GameObject)Instantiate(go);

        addDrawCnt(go);
        addBlockCnt(go);
        decrementBlockCounts();                         //Reduce counter for all cards which are blocked by a previous draw.
        lastCardIndex = getCardIndex(go);
        saveCardIndex();

        getCardAnimator();
        spawnedCard.transform.SetParent(CardParent);
        spawnedCard.transform.localScale = new Vector3(1f, 1f, 1f);
        actMoveDistance = Vector3.zero;

        return(spawnedCard);
    }
示例#4
0
文件: CardStack.cs 项目: jilcky/Save
    public void addToFollowUpStack(GameObject element, int delay)
    {
        C_folluwUpStackElement newElement = new C_folluwUpStackElement();

        cardIndex aci = getCardIndex(element);
        cardIndex ci  = new cardIndex();

        ci.cardSubIndex = aci.cardSubIndex;
        ci.groupIndex   = aci.groupIndex;
        ci.validIndex   = aci.validIndex;

        newElement.followUpCard = ci;
        newElement.cardDelay    = delay;
        newElement.waitingTime  = 0;

        followUpStack.followUpStack.Add(newElement);
        saveFollowUpStack();
    }