Ejemplo n.º 1
0
    public void InitializeGame()
    {
        totalPlayers.Clear();
        playerNames.Clear();
        Debug.Log(SelectPlayField.whichBoard);
        mat.mainTexture = boardTexture[SelectPlayField.whichBoard];
        print("from manager : " + PlayerSelection.playerInfo.Count);
        for (int i = 0; i < PlayerSelection.playerInfo.Count; i++)
        {
            totalPlayers.Add(PlayerSelection.playerInfo[i].color);
            playerNames.Add(PlayerSelection.playerInfo[i].name);
        }

        for (int i = 0; i < totalPlayers.Count; i++)
        {
            switch (totalPlayers[i])
            {
            case PawnColor.c_Blue:
                BlueGameObject.SetActive(true);
                break;

            case PawnColor.c_Red:
                RedGameObject.SetActive(true);
                break;

            case PawnColor.c_Green:
                GreenGameObject.SetActive(true);
                break;

            case PawnColor.c_Yellow:
                YellowGameObject.SetActive(true);
                break;
            }
        }

        if (!PlayerSelection.isNetworkedGame)
        {
            int randIndex = Random.Range(0, totalPlayers.Count);
            currentPlayerTurn = totalPlayers[randIndex];
            if (!CheckAITurn())
            {
                ui_m.ActivateSpinButton();
            }
            ui_m.ShowCurrentTurn(currentPlayerTurn, playerNames[randIndex]);
            Debug.Log("Non Networked");
        }
        else
        {
            Debug.Log("Networked");
            nm_server.GetStartingTurn(totalPlayers.Count);
        }

        ui_m.RemoveLoadingScreen();
    }
Ejemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     DiceValues = new List <int>();
     am         = GetComponent <AchievementsManager>();
     players    = GameObject.FindGameObjectsWithTag("Player");
     BlueGameObject.SetActive(false);
     GreenGameObject.SetActive(false);
     RedGameObject.SetActive(false);
     YellowGameObject.SetActive(false);
     if (!PlayerSelection.isNetworkedGame)
     {
         GameObject obj = (GameObject)Instantiate(NormalDice, DicePosition.transform.position, Quaternion.identity);
         dice = obj.GetComponent <DiceThrow>();
         InitializeGame();
     }
 }
Ejemplo n.º 3
0
 // Use this for initialization
 void Start()
 {
     Debug.Log("player info : " + PlayerSelection.playerInfo);
     DiceValues = new List <int>();
     am         = GetComponent <AchievementsManager>();
     players    = GameObject.FindGameObjectsWithTag("Player");
     BlueGameObject.SetActive(false);
     GreenGameObject.SetActive(false);
     RedGameObject.SetActive(false);
     YellowGameObject.SetActive(false);
     redHomeCount = blueHomeCount = yellowHomeCount = greenHomeCount = -11;
     if (!PlayerSelection.isNetworkedGame)
     {
         GameObject obj = (GameObject)Instantiate(NormalDice, DicePosition.transform.position, Quaternion.identity);
         dice = obj.GetComponent <DiceThrow>();
         Invoke("InitializeGame", 1f);
     }
 }
Ejemplo n.º 4
0
    public void InitializeGame()
    {
        CoinManager.justDeductedCoins = 0;
        totalPlayers.Clear();
        playerNames.Clear();
        Debug.Log(SelectPlayField.whichBoard);
        mat.mainTexture = boardTexture[SelectPlayField.whichBoard];
        // print("from manager : " + PlayerSelection.playerInfo.Count);
        for (int i = 0; i < PlayerSelection.playerInfo.Count; i++)
        {
            totalPlayers.Add(PlayerSelection.playerInfo[i].color);
            playerNames.Add(PlayerSelection.playerInfo[i].name);

            if (playerNames[i] == "" || playerNames[i] == null)
            {
                switch (totalPlayers[i])
                {
                case PawnColor.c_Blue:
                    playerNames[i] = "Blue";
                    break;

                case PawnColor.c_Green:
                    playerNames[i] = "Green";
                    break;

                case PawnColor.c_Red:
                    playerNames[i] = "Red";
                    break;

                case PawnColor.c_Yellow:
                    playerNames[i] = "Yellow";
                    break;
                }
            }
        }

        totalPlayersPlayingCount = totalPlayers.Count;

        totalRewardCoins = totalPlayers.Count * JoinCost;

        for (int i = 0; i < totalPlayers.Count; i++)
        {
            switch (totalPlayers[i])
            {
            case PawnColor.c_Blue:
                BlueGameObject.SetActive(true);
                blueHomeCount = 0;
                break;

            case PawnColor.c_Red:
                RedGameObject.SetActive(true);
                redHomeCount = 0;
                break;

            case PawnColor.c_Green:
                GreenGameObject.SetActive(true);
                greenHomeCount = 0;
                break;

            case PawnColor.c_Yellow:
                YellowGameObject.SetActive(true);
                yellowHomeCount = 0;
                break;
            }
        }

        if (!PlayerSelection.isNetworkedGame)
        {
            int randIndex = Random.Range(0, totalPlayers.Count);
            currentPlayerTurn = totalPlayers[randIndex];
            if (!CheckAITurn())
            {
                ui_m.ActivateSpinButton();
            }
            ui_m.ShowCurrentTurn(currentPlayerTurn, playerNames[randIndex]);
            Debug.Log("Non Networked");
        }
        else
        {
            Debug.Log("Networked");
            nm_server.GetStartingTurn(totalPlayers.Count);
        }

        ui_m.RemoveLoadingScreen();

        AnalyticsResult result = Analytics.CustomEvent("GameStart");

        print("game start analytics result : " + result);
    }