예제 #1
0
        public sealed override void Play()
        {
            Transform grid     = PlayerController.GetInstance().grids[5];
            ArrayList cardList = new ArrayList();

            for (int i = 0; i < grid.childCount; i++)
            {
                GameObject             card     = Instantiate(grid.GetChild(i).gameObject);
                EventDelegate.Callback callback = delegate
                {
                    int index = 0;
                    for (int ii = 0; ii < ShowCards.GetInstance().totalGrid.childCount; ii++)
                    {
                        if (string.Format("{0}(Clone)", ShowCards.GetInstance().totalGrid.GetChild(ii).name) == card.name)
                        {
                            index = ii;
                        }
                    }
                    ShowCards.GetInstance().card = ShowCards.GetInstance().totalGrid.GetChild(index);

                    ShowCards.GetInstance().card.SetTarget(PlayerController.GetInstance().grids[1]);
                    base.Play();
                };
                EventDelegate.Add(card.GetComponent <UIButton>().onClick, callback);
                cardList.Add(card);
            }
            ShowCards.GetInstance().ShowLeader(cardList, grid, true, () => ShowCards.GetInstance().Hide());
        }
예제 #2
0
    // Use this for initialization
    void Start()
    {
        deck           = GameObject.FindGameObjectWithTag("Deck").GetComponent <DeckScript>();
        cardsObtained  = deck.cardsObtained.ToArray();
        currentCards   = new GameObject[7];
        cardStack_more = new Stack <int>(deck.cardsObtained);
        cardStack_less = new Stack <int>();
        sendCards      = string.Join(",", new List <int>(cardsObtained).ConvertAll(i => i.ToString()).ToArray());

        initCardPositions();
        initCardAngles();

        layoutCards(cardStack_more.Count);
        inAnimation = false;
        speed       = 0.75f;
        zoomed      = false;
        showCards   = GameObject.Find("ShowCards").GetComponent <ShowCards>();
        showCards.DisableObject();
        currentIndex = 0;
        receiveHolder.SetActive(false);
        acceptHolder.SetActive(false);
        waitHolder.SetActive(false);
        offer         = false;
        receiveOffer  = false;
        ignoreToggle  = false;
        accept        = false;
        receiveAccept = false;
        readyForCards = true;
        receiveZoomed = false;
        inTrade       = false;
    }
예제 #3
0
        public void ShowCardsTest()
        {
            //arrange
            int       yourScore     = 20;
            int       computerScore = 23;
            string    expected      = "\nYou Won!";
            ShowCards showCards     = new ShowCards();
            //act
            string actual = showCards.Check(yourScore, computerScore);

            //assert
            Assert.AreEqual(expected, actual);
        }
예제 #4
0
        public sealed override void Play()
        {
            System.Random random   = new System.Random();
            Transform     grid     = EnemyController.GetInstance().grids[1];
            int           max      = grid.childCount;
            int           random1  = random.Next(0, max);
            int           random2  = random.Next(0, max);
            int           random3  = random.Next(0, max);
            ArrayList     cardList = new ArrayList();

            cardList.Add(Instantiate(grid.GetChild(random1).gameObject));
            cardList.Add(Instantiate(grid.GetChild(random2).gameObject));
            cardList.Add(Instantiate(grid.GetChild(random3).gameObject));
            ShowCards.GetInstance().ShowLeader(cardList, grid, false, () => base.Play());
        }
예제 #5
0
        public sealed override void Play()
        {
            Transform grid     = PlayerController.GetInstance().grids[0];
            ArrayList cardList = new ArrayList();

            for (int i = 0; i < grid.childCount; i++)
            {
                if (grid.GetChild(i).GetComponent <CardProperty>().effect == Global.Effect.clear_sky ||
                    grid.GetChild(i).GetComponent <CardProperty>().effect == Global.Effect.frost ||
                    grid.GetChild(i).GetComponent <CardProperty>().effect == Global.Effect.fog ||
                    grid.GetChild(i).GetComponent <CardProperty>().effect == Global.Effect.rain)
                {
                    GameObject card   = Instantiate(grid.GetChild(i).gameObject);
                    UIButton   button = card.GetComponent <UIButton>();
                    EventDelegate.Add(button.onClick, () => card.GetComponent <CardBehavior>().Play());
                    EventDelegate.Add(button.onClick, () => isEnabled = false);
                    cardList.Add(card);
                }
            }

            ShowCards.GetInstance().ShowLeader(cardList, grid, true, () => ShowCards.GetInstance().Hide());
        }
예제 #6
0
 public override void Play()
 {
     isEnabled = false;
     ShowCards.GetInstance().Hide();
     PlayerController.GetInstance().PlayOver(transform);
 }
예제 #7
0
 public sealed override void Play()
 {
     ShowCards.GetInstance().replaceInt = 0;
     Throw();
 }
예제 #8
0
 private void Start()
 {
     showCards = GetComponent <ShowCards>();
 }
예제 #9
0
    // Use this for initialization
    void Start()
    {
        deck = GameObject.FindGameObjectWithTag("Deck").GetComponent<DeckScript>();
        cardsObtained = deck.cardsObtained.ToArray();
        currentCards = new GameObject[7];
        cardStack_more = new Stack<int>(deck.cardsObtained);
        cardStack_less = new Stack<int>();
        sendCards = string.Join(",", new List<int>(cardsObtained).ConvertAll(i => i.ToString()).ToArray());

        initCardPositions();
        initCardAngles();

        layoutCards(cardStack_more.Count);
        inAnimation = false;
        speed = 0.75f;
        zoomed = false;
        showCards = GameObject.Find("ShowCards").GetComponent<ShowCards>();
        showCards.DisableObject();
        currentIndex = 0;
        receiveHolder.SetActive(false);
        acceptHolder.SetActive(false);
        waitHolder.SetActive(false);
        offer = false;
        receiveOffer = false;
        ignoreToggle = false;
        accept = false;
        receiveAccept = false;
        readyForCards = true;
        receiveZoomed = false;
        inTrade = false;
    }