Esempio n. 1
0
    public void StartMatch(VisualPlayer v_player = null, VisualMinion v_minion = null, int visualBoardHeight = 0, MatchUI matchUI = null)
    {
        V_Player          = v_player;
        V_Minion          = v_minion;
        VisualBoardHeight = visualBoardHeight;

        if (Visual)
        {
            // UI
            MatchUI       = matchUI;
            MatchUI.Match = this;
            MatchUI.UpdatePlayerBar();
            MatchUI.UpdateTurnText();
            if (MatchType == MatchType.AI_vs_AI)
            {
                MatchUI.UpdatePlayerGenomes();
            }

            // Summon Players
            Player1.Visual = GameObject.Instantiate(V_Player, new Vector3(0, 0, -(VisualBoardHeight / 2)), Quaternion.identity);
            Player2.Visual = GameObject.Instantiate(V_Player, new Vector3(0, 0, VisualBoardHeight / 2), Quaternion.identity);
            Player1.Color  = PlayerColor;
            Player2.Color  = PlayerColor;
            VisualActions.Add(new VA_SummonPlayer(Player1.Visual, PlayerColor));
            VisualActions.Add(new VA_SummonPlayer(Player2.Visual, PlayerColor));
        }

        // Let's go
        Phase = MatchPhase.GameReady;
    }
Esempio n. 2
0
    /// <summary>
    /// Gets card options for each player. AI players also instantly chose a card (as set a card as ChosenCard)
    /// </summary>
    private void GetCardOptions()
    {
        // Pick Cards
        Player1.ChosenCard = null;
        Player2.ChosenCard = null;
        List <Card> Player1RandomCards = GetCardOptionsFor(Player1);
        List <Card> Player2RandomCards = GetCardOptionsFor(Player2);

        Player1.PickCard(Player1RandomCards);
        Player2.PickCard(Player2RandomCards);

        // Visual
        if (Visual)
        {
            if (MatchType == MatchType.AI_vs_AI)
            {
                MatchUI.ShowCards(Player1RandomCards, Player1, false, false);
                MatchUI.ShowCards(Player2RandomCards, Player2, false, false);
            }
            else
            {
                MatchUI.ShowCards(Player1RandomCards, Player1, false, true);
                MatchUI.ShowCards(Player2RandomCards, Player2, true, false); // Hide cards for opponent in human match
            }

            MatchUI.UpdateTurnText();
            // Show Genomes is AI vs AI match
            if (MatchType == MatchType.AI_vs_AI)
            {
                MatchUI.UpdatePlayerGenomes();
            }
        }
        if (Log)
        {
            string optionString = "";
            foreach (Card c in Player1RandomCards)
            {
                optionString += c.Name + ", ";
            }
            optionString = optionString.TrimEnd(new char[] { ',', ' ' });
            Debug.Log(Player1.Name + " chose " + Player1.ChosenCard.Name + " from " + optionString);

            optionString = "";
            foreach (Card c in Player2RandomCards)
            {
                optionString += c.Name + ", ";
            }
            optionString = optionString.TrimEnd(new char[] { ',', ' ' });
            Debug.Log(Player2.Name + " chose " + Player2.ChosenCard.Name + " from " + optionString);
        }
    }