Example #1
0
    //Made this its own class so that we could use a for loop to draw 5 cards
    public void DrawCard()
    {
        //looping through each deck in play
        foreach (Deck deck in GameManager.Instance.Decks)
        {
            //finding the correct deck to be used
            if (deck.DeckId == GameManager.Instance.deckPicked)
            {
                //checking to make sure there are cards left in the deck
                if (deck.Cards.Count != 0)
                {
                    //retrieving the object created in the form of the "instance" earlier
                    holder = ScriptableObject.FindObjectOfType <CardRetrievalFromDeck>();
                    //calling  the object's CardDrawRandomizer function, which selects a random card from the deck
                    holder.CardDrawRandomizer();
                    //calling this script's generateCardObject function,  which creates an object to represent the card
                    generateCardObject();
                    //calling the script object's setSprite function, which passes in the SpriteRenderer, and sets it's sprite to the corresponding card chosen in CardDrawRandomizer
                    holder.setSprite(sr);

                    if (deck.Cards.Count == 0)
                    {
                        //calling this script's changeDeck function, which replaces the deck with an out of cards image
                        changeDeck();
                    }
                }
                else
                {
                }
            }
        }
    }
Example #2
0
    // Use this for initialization
    void Start()
    {
        scriptInstance = ScriptableObject.CreateInstance("CardRetrievalFromDeck");       //so you can use the script
        holder         = ScriptableObject.FindObjectOfType <CardRetrievalFromDeck>();    //access to script
        changePlayer   = GameObject.Find("Main Camera").GetComponent <HideShowBoards>(); //to change players
        cameraHolder   = GameObject.Find("Main Camera");                                 // to access the scripts of the main camera

        if (GameManager.Instance.round == 1)                                             //will only happen in the first round
        {
            for (int i = 0; i < 5; i++)
            {
                holder.drawCP3Deck(); //adds the cards to the computers hand

                //draws a card and puts it into the hand
                cardParent            = GameObject.Find("Computer Three Board/CP3Hand").transform;
                holder.cardNameHolder = "back_of_card";
                generateCardObject();
                holder.setSpriteCP1(sr); //generating the card object to be placed into the panel
            }
        }

        round = 0; //starts at 1, goes to 10

        sort = 5;  //starts at 5

        StartCoroutine("computerPerforms");
    }
Example #3
0
    // Use this for initialization
    void Start()
    {
        Cursor.visible   = false;                                                        //hides the mouse from the user
        Cursor.lockState = CursorLockMode.Locked;                                        //you cannot use the cursor

        scriptInstance = ScriptableObject.CreateInstance("CardRetrievalFromDeck");       //so you can use the script
        holder         = ScriptableObject.FindObjectOfType <CardRetrievalFromDeck>();    //access to script
        changePlayer   = GameObject.Find("Main Camera").GetComponent <HideShowBoards>(); //to change players
        cameraHolder   = GameObject.Find("Main Camera");                                 //sets the object to just the main camera

        if (GameManager.Instance.round == 1)                                             //only happens in the first round
        {
            for (int i = 0; i < 5; i++)
            {
                holder.drawCP1Deck(); //adds the cards to the computers hand

                //draws a card and puts it into the hand
                cardParent            = GameManager.Instance.cp1AI;
                holder.cardNameHolder = "back_of_card";
                generateCardObject();
                holder.setSpriteCP1(sr); //generating the card object to be placed into the panel
            }
        }

        StartCoroutine("computerPerforms"); //goes through the function needed for the AI
    }
Example #4
0
    // Use this for initialization
    void Start()
    {
        threeCard = GameManager.Instance.threeCardBurst;

        holder     = ScriptableObject.FindObjectOfType <CardRetrievalFromDeck>(); //gets access to the script
        playerDraw = ScriptableObject.FindObjectOfType <DebugDealer>();           //gets access to the script
        cardParent = GameObject.Find("Game Board Container/Player Board/Board/Player/Hand").transform;
    }
Example #5
0
 //code that executes on the script load
 public void Start()
 {
     holder     = ScriptableObject.FindObjectOfType <CardRetrievalFromDeck>(); //gets access to the script
     playerDraw = ScriptableObject.FindObjectOfType <DebugDealer>();           //gets access to the script
 }
 // Use this for initialization
 void Start()
 {
     holder = ScriptableObject.FindObjectOfType <CardRetrievalFromDeck>(); //gets access to the script
 }
 // Use this for initialization
 void Start()
 {
     showBoard  = GameObject.Find("Main Camera").GetComponent <CheckDeckAndDiscardPlayer>(); //sets object
     holder     = ScriptableObject.FindObjectOfType <CardRetrievalFromDeck>();               //gets access to the script
     playerDraw = ScriptableObject.FindObjectOfType <DebugDealer>();                         //gets access to the script
 }