示例#1
0
    GameObject[] biddingWar(GameObject[] participants, AdventureCard test)
    {
        bool biddingOver           = false;
        bool playerSubmitSomething = false;
        int  playerBidding         = 0;

        currentBid = test.getBidPoints();

        //Bid to remove cards
        //knock out other contestants
        //take into account free bids
        //winner discards # of cards = bids - freeBids

        while (!biddingOver)
        {
            playerSubmitSomething = false;
            // spawn input field for the current player
            Instantiate(Resources.Load("PreFabs/inputfield") as GameObject, participants[playerBidding].transform);

            while (!playerSubmitSomething)
            {
                if (playerBid <= currentBid)
                {
                    participants [playerBidding] = null;
                    GameObject[] temp = new GameObject[participants.Length - 1];
                    for (int j = 0; j < participants.Length; j++)
                    {
                        if (participants[j] != null)
                        {
                            temp [j] = participants [j];
                        }
                    }
                    participants = temp;
                }
                else
                {
                    playerSubmitSomething = true;
                }
            }
            if (participants.Length < 1)
            {
//***************** PARTICIPANT NEEDS TO DISCARD CARDS - FREE BIDS FROM ALLIES *****************
                return(participants);
            }
            else
            {
                if (playerBidding > participants.Length)
                {
                    playerBidding = 0;
                }
                else
                {
                    playerBidding++;
                }
            }
        }
        return(participants);
        //continue play with the last contestant in quest
    }
示例#2
0
 //Remove one adventure card from the list, this can be used to remove the amour card at the end of the quest. So we can keep the other cards
 public void Remove(AdventureCard card)
 {
     if (cardsPlayed == null)
     {
         return;
     }
     cardsPlayed.Remove(card);
 }
示例#3
0
 //Adds one adventure card to the list
 public void Add(AdventureCard card)
 {
     if (cardsPlayed == null)
     {
         cardsPlayed = new List <AdventureCard>();
     }
     cardsPlayed.Add(card);
 }
示例#4
0
文件: Hand.cs 项目: k80nelson/Quests
 public void Add(AdventureCard card)
 {
     if (cards == null)
     {
         cards = new List <AdventureCard>();
     }
     cards.Add(card);
 }
示例#5
0
 public void AddCard(AdventureCard card)
 {
     if (_hand == null)
     {
         _hand = ScriptableObject.CreateInstance <Hand>();
     }
     _hand.Add(card);
     cards += 1;
 }
示例#6
0
    public void Playthrough(GameObject participant, int stage)
    {
        bool          foeStage  = false;
        bool          testStage = false;
        AdventureCard testCard  = null;

        Debug.Log("Starting PLAYTHROUGH");
        Debug.Log("The stage beginning is: " + stage);
        //GameObject tempDisplay = null;
        //change between participants, knock them out, continue through stages
        for (int x = 0; x < numStages; x++)
        {
            Debug.Log("Stage: " + x);
            foreach (AdventureCard c in currentQuest[x])
            {
                Debug.Log(c.getName());
            }
        }

        List <AdventureCard> tempList = currentQuest[stage];

        foreach (AdventureCard c in tempList)
        {
            if (c.getType() == "Foe")
            {
                foeStage = true;
                Debug.Log("foeStage is true");
            }
            else if (c.getType() == "Test")
            {
                testStage = true;
                testCard  = c;
                Debug.Log("testStage is true");
            }
        }
        if (foeStage)
        {
            //display a foe background image
            Debug.Log("starting the foe stage");
            //tempDisplay = DisplayStage(testCard);
            runThroughFoeStage(participant, currentQuest[stage]);
            //StartCoroutine (runThroughFoeStage (stage));
            //participants = runThroughFoeStage (participants, stage);
        }
        else if (testStage)
        {
            //display the test image and the current bid score
            Debug.Log("starting the test stage");
            //tempDisplay = DisplayStage(testCard);

            //participants = biddingWar(participants, testCard);
        }
        //destroy stages and displayedCard
        //Destroy(tempDisplay);
        //draw card for each participant
        //drawCards(participants);
    }
示例#7
0
    void Rpc_AddCard(int index)
    {
        if (!isLocalPlayer)
        {
            return;
        }
        AdventureCard card = GameManager.instance.dict.findCard(index) as AdventureCard;

        _view.addCard(card);
    }
示例#8
0
    public bool testValid(int id, Draggable d)
    {
        testFlag = false;

        AdventureCard currCard = d.gameObject.GetComponent <AdventureCard>();

        if (currCard.type == AdventureCard.Type.AMOUR || currCard.type == AdventureCard.Type.ALLY)
        {
            return(false);
        }

        List <AdventureCard> currStage = new List <AdventureCard>(stagesTransforms[id].GetComponentsInChildren <AdventureCard>());

        if (currStage.Find(i => i.type == AdventureCard.Type.TEST) != null)
        {
            return(false);
        }

        if ((currCard.type == AdventureCard.Type.FOE) && currStage.Find(i => i.type == AdventureCard.Type.FOE) != null)
        {
            return(false);
        }

        if ((currCard.type == AdventureCard.Type.WEAPON) &&
            ((currStage.Find(i => i.type == AdventureCard.Type.TEST) != null) ||
             !(currStage.Find(i => i.type == AdventureCard.Type.FOE) != null) ||
             (currStage.Find(i => i.Name == currCard.Name) != null)))
        {
            return(false);
        }

        //This nested for loop is to check if there is a test already in play
        for (int i = 0; i < stages; i++)
        {
            List <AdventureCard> testStage = new List <AdventureCard>(stagesObjects[i].GetComponentsInChildren <AdventureCard>());
            for (int j = 0; j < testStage.Count; j++)
            {
                if (testStage[j].type == AdventureCard.Type.TEST)
                {
                    testFlag = true;
                }
            }
        }

        if ((currCard.type == AdventureCard.Type.TEST) && ((currStage.Count > 0) || testFlag))
        {
            return(false);
        }


        return(true);
    }
示例#9
0
    GameObject DisplayStage(AdventureCard test)
    {
        GameObject displaying = Instantiate(stageDisplay, GameObject.Find("MainUI").transform);

        if (test == null)
        {
            displaying.GetComponent <Image> ().sprite = Resources.Load("foeCard") as Sprite;
        }
        else
        {
            displaying.GetComponent <Image> ().sprite = test.gameObject.GetComponent <Image> ().sprite;
        }
        return(displaying);
    }
示例#10
0
 public void addAlly(AdventureCard card)
 {
     if (!isServer)
     {
         return;
     }
     if (card == null)
     {
         return;
     }
     if (card.type == AdventureCard.Type.ALLY)
     {
         allies.Add(card.GetComponent <AdventureCard>());
     }
 }
示例#11
0
    public void OnDrop(PointerEventData eventData)
    {
        User          player = GameObject.Find("Hand").transform.parent.GetComponent <User> ();
        AdventureCard z      = eventData.pointerDrag.GetComponent <AdventureCard> ();

        if (z.getType() == "Ally")
        {
            player.setBaseAttack(player.getbaseAttack() + z.getBattlePoints());
            //player.setBids(player.getBaseBids() + z.getBids);
//			Debug.Log(");
            player.addAlly(z);
            z.gameObject.SetActive(false);


            //Destroy(z.gameObject);
        }
    }
示例#12
0
    public bool validate(AdventureCard card)
    {
        if (model.players[model.activePlayer].overMax())
        {
            game.view.promptUser("You are holding too many cards.");
            return(false);
        }

        if (card.type == AdventureCard.Type.FOE || card.type == AdventureCard.Type.TEST)
        {
            return(false);
        }

        List <AdventureCard> cardsPlayed = new List <AdventureCard>(cardArea.GetComponentsInChildren <AdventureCard>());

        if (card.type == AdventureCard.Type.AMOUR)
        {
            if (model.players[model.activePlayer].cardsPlayed4Quest.containsAmour())
            {
                return(false);
            }
            if (cardsPlayed.Find(i => i.type == AdventureCard.Type.AMOUR) != null)
            {
                return(false);
            }
        }

        if (card.type == AdventureCard.Type.WEAPON)
        {
            if (cardsPlayed.Find(i => i.Name == card.Name) != null)
            {
                return(false);
            }
        }

        return(true);
    }
示例#13
0
 public void addAlly(AdventureCard Ally)
 {
     hand_ally.Add(Ally);
     logger.info("User.cs :: addAlly function has been called for Player:  " + this.user_name + " Adding Ally: " + Ally.getName());
     logger.info("User.cs :: addAlly function has been called for Player:  " + this.user_name + " Ally Battle Points: " + Ally.getBonusBattlePoints());
 }
示例#14
0
    public void addCard(AdventureCard card)
    {
        Card NewCard = Instantiate(cardPrefab, cardSpawnPos).GetComponent <Card>();

        NewCard.setCard(card);
    }
示例#15
0
 public void addAlly(AdventureCard Ally)
 {
     hand_ally.Add(Ally);
 }
示例#16
0
文件: Hand.cs 项目: k80nelson/Quests
 public void remove(AdventureCard card)
 {
     cards.Remove(card);
 }
示例#17
0
 public int getIndex(AdventureCard card)
 {
     return(prefabs.ToList <GameObject>().FindIndex(x => card.Name.Contains(x.name)));
 }
示例#18
0
 public void discard(AdventureCard card)
 {
     Debug.Log("[AdventureDeck.cs:discard] " + card.Name + " discarded");
     discardDeck.Add(getIndex(card));
 }
示例#19
0
 public void removeCard(AdventureCard card)
 {
     hand.remove(card);
 }
示例#20
0
 public void removeCard(AdventureCard card)
 {
     _hand.remove(card);
     cards -= 1;
 }
示例#21
0
 public void removeCard(AdventureCard card)
 {
     model.removeCard(card);
     Debug.Log("[PlayerController.cs:removeCard] " + card.name + " removed from player " + (model.index + 1));
 }