Beispiel #1
0
 /// <summary>
 /// implements the ability to place a selected card from a hand into the playspace
 /// </summary>
 public void PlaceCard()
 {
     if (CanHighlight == true && CanPlaceCardHere() == true && apm.GetActionPointsAvailable() > 0)
     {
         //finds the image we want to place on the selected tile
         foreach (Image image in possibleActiveImages)
         {
             //places the image on the tile
             if (image.sprite.name == activeHand.selectedCard)
             {
                 activeHand.RemoveCardFromHand();
                 ach.HandleCard(image.sprite.name);
                 if (image.sprite.name != "Bulldozer")
                 {
                     gameObject.GetComponent <Image>().sprite = image.sprite;
                     Console.instance.WriteToConsole("Played " + image.sprite.name);
                 }
                 else
                 {
                     gameObject.GetComponent <Image>().sprite = GameObject.Find("Dirt").GetComponent <Image>().sprite;
                     Console.instance.WriteToConsole("Bulldozer destroyed an obstacle");
                 }
                 apm.UseActionPoint();
                 break;
             }
         }
     }
 }
Beispiel #2
0
 public void PlayScene()//選んだステージで遊ぶ
 {
     if (pAPManager.UseActionPoint(int.Parse(StageInfoList[PlayStageNum][1])))
     {
         PlayerPrefs.SetString("RcoveryTime", System.DateTime.Now.ToString());
         PlayerPrefs.SetInt("AP", pAPManager.nowPoint);
         pNextScene.StageScene(PlayStageNum);
         Debug.Log("ロード");
     }
     else
     {
         Debug.Log("スタミナないわ(#・∀・)");
     }
 }
Beispiel #3
0
    /// <summary>
    /// Finds the hand based off of the tag, then adds to the respective hand. Updates gold amount and shifts market cards
    /// </summary>
    /// <param name="handTag">Tag of the hand you want to add card to</param>
    private void HandleHand(string handTag, int costOfCard, GameObject cardToAdd)
    {
        //find the hand with the given tag
        GameObject handObj = GameObject.FindGameObjectWithTag(handTag);

        if (handObj != null)
        {
            Hand hand = handObj.GetComponent <Hand>();

            //if the hand is not full, add card to hand, shift market cards, update gold
            if (hand != null && hand.IsFull() == false)
            {
                hand.AddCardToHand(cardToAdd.GetComponent <Image>());
                //passiveHand.HandleCard(cardToAdd);
                GoldManager.instance.SetGoldAmount(GoldManager.instance.GetGoldAmount() - costOfCard);
                apm.UseActionPoint();

                Console.instance.WriteToConsole("Bought " + cardToAdd.GetComponent <Image>().sprite.name);

                if (costOfCard != costOfDeckCard)
                {
                    market.ShiftCardsForward(gameObject);
                }
            }
            else if (hand.IsFull() == true)
            {
                //tell player the hand is full
                Console.instance.WriteToConsole(hand.name + " is full.");
            }
        }
        //if no tag is found, throw exception
        else
        {
            string exceptionString = String.Format("No {0} found. Ensure the {0} object has the proper tag", handTag);
            throw new System.Exception(exceptionString);
        }
    }