コード例 #1
0
    void PlayCard(GameResource resource)
    {
        ResourceCard newCard = Instantiate(ResourceCardPF, HandLocation);

        newCard.transform.position = HandLocation.position + Vector3.right * 12f;
        newCard.SetResource(resource);
        CardsInHand.Add(newCard);

        if (CardsInHand.Count() == MaxHandSize + 1) // we just drew the first overflowing card
        {
            HandIsTooFullCallback();
        }
        else if (CardsInHand.Count() == 1) // this is our first card
        {
            MyAudioSource.clip = resource.ActiveCardSound;
            MyAudioSource.Play();
        }

        AdjustCardsInHandPosition();
    }
コード例 #2
0
    public void ConsumeActiveCard()
    {
        /*
         * MyAudioSource.pitch = Random.Range(.95f, 1.05f);
         * MyAudioSource.clip = CardPlacedSound;
         * MyAudioSource.Play();
         */
        ResourceCard removedCard = GetActiveCard();

        CardsInHand.RemoveAt(0);
        Destroy(removedCard.gameObject);

        if (CardsInHand.Count() == MaxHandSize) // we just went down to less than overflowing
        {
            HandIsNoLongerTooFullCallback();
        }
        else if (CardsInHand.Count > 0)
        {
            MyAudioSource.clip = CardsInHand[0].RepresentedResource.ActiveCardSound;
            MyAudioSource.Play();
        }

        AdjustCardsInHandPosition();
    }