Exemplo n.º 1
0
    public void AddCard(S_CardBase card)
    {
        cards.Add(card);
        Vector2 cardSize = card.GetSize();

        card.moveTo(new Vector3(transform.position.x, transform.position.y - (cardSize.y * 0.25f) * cards.Count, -0.025f * cards.Count), 20f);
    }
Exemplo n.º 2
0
 public void AddCard(S_CardBase card)
 {
     cards.Add(card);
     moveToDiscard(card);
     card.onDiscard = true;
     card.OnCardPlayed();
 }
Exemplo n.º 3
0
 public void SelectCard(S_CardBase card)
 {
     if (selectedCard != card && selectedCard)
     {
         selectedCard.Deselect();
     }
     selectedCard = card;
     card.Select();
 }
Exemplo n.º 4
0
    private int GetBuildCost(S_CardBase card)
    {
        int cost = 0;

        for (int i = 0; i < 5; i++)
        {
            int dif = card.cost[i] - ressources[i];
            cost += GetRessourceCost(i) * dif;
        }
        return(cost);
    }
Exemplo n.º 5
0
 public void AddHiddenByCard(S_CardBase toAdd)
 {
     if (!hiddenBy[0])
     {
         hiddenBy[0] = toAdd;
     }
     else
     {
         hiddenBy[1] = toAdd;
     }
 }
Exemplo n.º 6
0
 public void Build()
 {
     if (!selectedCard)
     {
         return;
     }
     if (currentPlayer.BuildCard(selectedCard))
     {
         selectedCard.Deselect();
         selectedCard.OnCardPlayed();
         NextTurn();
         selectedCard = null;
     }
 }
Exemplo n.º 7
0
 public void Discard()
 {
     if (selectedCard)
     {
         selectedCard.Deselect();
         discard.AddCard(selectedCard);
         NextTurn();
     }
     else
     {
         discard.DisplayDiscardedCards();
     }
     selectedCard = null;
 }
Exemplo n.º 8
0
 public void AddHideCard(S_CardBase toAdd)
 {
     if (!hide[0])
     {
         hide[0] = toAdd;
     }
     else
     {
         hide[1] = toAdd;
     }
     if (toAdd)
     {
         toAdd.AddHiddenByCard(GetComponent <S_CardBase>());
     }
 }
Exemplo n.º 9
0
 public bool BuildCard(S_CardBase card)
 {
     for (int i = 0; i < 5; i++)
     {
         if (ressources[i] < card.cost[i])
         {
             return(false);
         }
     }
     foreach (S_Stack stack in stacks)
     {
         if (stack.type == card.type)
         {
             stack.AddCard(card);
         }
     }
     return(true);
 }
Exemplo n.º 10
0
 public int EstimateBuildCost(S_CardBase card)
 {
     if (card == null)
     {
         estimatedCost.GetComponentInChildren <TextMesh>().text = "";
         estimatedCost.SetActive(false);
     }
     else
     {
         int cost = GetBuildCost(card);
         if (cost != 0)
         {
             estimatedCost.SetActive(true);
             estimatedCost.GetComponentInChildren <TextMesh>().text = "" + cost;
         }
     }
     return(10);
 }
Exemplo n.º 11
0
 public void DisplayDiscardedCards()
 {
     if (cards.Count > 0)
     {
         int     lineSize = 8;
         Vector2 size     = cards[0].GetSize();
         float   x;
         int     lines = cards.Count / lineSize;
         if (cards.Count % lineSize != 0)
         {
             lines++;
         }
         int   j = 0;
         float y = lines / 2 * (size.x * 1.1f);
         if (lines % 2 == 0)
         {
             y -= (0.5f * (size.x * 1.1f));
         }
         for (int line = 0; line < lines; line++)
         {
             int currentSize = (cards.Count >= lineSize * (line + 1)) ? lineSize : cards.Count % lineSize;
             x = currentSize / 2 * (size.y * -1.1f);
             if (currentSize % 2 == 0)
             {
                 x += (0.5f * (size.y * 1.1f));
             }
             for (int col = 0; col < currentSize; col++)
             {
                 S_CardBase card = cards[j];
                 card.transform.eulerAngles = new Vector3(0, 0, 0);
                 Vector3 pos = new Vector3(x, y, -2);
                 card.moveTo(pos, 20);
                 j++;
                 x += (size.y * 1.1f);
             }
             y -= (size.x * 1.1f);
         }
     }
     back.Enable(true);
 }
Exemplo n.º 12
0
 private void moveToDiscard(S_CardBase card)
 {
     card.transform.eulerAngles = new Vector3(0, 0, 90);
     card.moveTo(new Vector3(transform.position.x, transform.position.y, transform.position.z + 0.01f), 20);
 }