private void SetGamemode(string dropdownValue)
 {
     if (dropdownValue == "Only Cards")
     {
         gamemode = gamemode.cards;
     }
     else if (dropdownValue == "Rolling Cube")
     {
         gamemode = gamemode.rollingCube;
     }
     else
     {
         gamemode = gamemode.cards;
         Debug.LogWarning("Can't set the gamemode to " + dropdownValue + " because that doens't exist! " +
                          "The gamemode is set the the default gamemode: Only Cards");
     }
 }
    private void Start()
    {
        team         = GameObject.Find("Team");
        playerScores = team.GetComponent <PlayerScores>();

        SetupPlayers();
        SetupScoreboard();

        // Setup the player highlight
        scoreboard.UpdateTurn(playerTurn);

        // Setup the gamemode
        currentGamemode = gameDatabase.GetGamemode();

        SetupCards();
        SetupFirstCard();
    }
 /// <summary>
 /// Initialise the script.
 /// </summary>
 void Start()
 {
     DontDestroyOnLoad(this.gameObject);
     bots     = true;
     Gamemode = gamemode.TeamDeathMatch;
 }
示例#4
0
    //----------------------------------------------------

    void Start()
    {
        score = new float[4];
        if (!DebugMode)
        {
            Player1isAI = PlayerPrefs.GetInt("Player1isAI");
            Player2isAI = PlayerPrefs.GetInt("Player2isAI");
            Player3isAI = PlayerPrefs.GetInt("Player3isAI");
            Player4isAI = PlayerPrefs.GetInt("Player4isAI");
        }


        if (Player1isAI == 1)                                                                                                                 // If player 1 is a human
        {
            PlayersOptions.Add(new PlayerOptions(true, 0, Player_GameController.current_player.Player_1, PlayerPrefs.GetInt("Player1Team"))); // TO DO. Change the last function parameter to be the proper team index for the player
            //Stores player options. Actual player objects are often deleted and replaced so anything that needs to stay through the match and isn't set through playerprefs should be stored in the PlayerOptions class
            PlayerList.Add((GameObject)Resources.Load("prefabs/player", typeof(GameObject)));                                                 //A new player prefab is set inside the PlayerList arraylist
            SetPlayerOptions(PlayersOptions[0], 0);                                                                                           // Setting the player options to the instantiated player prefab
            SpawnPlayer(0);
            TotalPlayerCount += 1;
        }
        //Human Players 2-4 are handled identically but with their proper values
        if (Player2isAI == 1)
        {
            PlayerList.Add((GameObject)Resources.Load("prefabs/player", typeof(GameObject)));
            PlayersOptions.Add(new PlayerOptions(true, 1, Player_GameController.current_player.Player_2, PlayerPrefs.GetInt("Player2Team")));
            SetPlayerOptions(PlayersOptions[1], 1);
            SpawnPlayer(1);
            TotalPlayerCount += 1;
        }
        if (Player3isAI == 1)
        {
            PlayerList.Add((GameObject)Resources.Load("prefabs/player", typeof(GameObject)));
            PlayersOptions.Add(new PlayerOptions(true, 2, Player_GameController.current_player.Player_3, PlayerPrefs.GetInt("Player3Team")));
            SetPlayerOptions(PlayersOptions[2], 2);
            SpawnPlayer(2);
            TotalPlayerCount += 1;
        }
        if (Player4isAI == 1)
        {
            PlayerList.Add((GameObject)Resources.Load("prefabs/player", typeof(GameObject)));
            PlayersOptions.Add(new PlayerOptions(true, 3, Player_GameController.current_player.Player_4, PlayerPrefs.GetInt("Player4Team")));
            SetPlayerOptions(PlayersOptions[3], 3);
            SpawnPlayer(3);
            TotalPlayerCount += 1;
        }
        if (!DebugMode)
        {
            switch (PlayerPrefs.GetInt("GameMode"))
            {
            case 0:
                GameMode = gamemode.TeamDeathMatch;
                break;

            case 1:
                GameMode = gamemode.DeathMatch;
                break;

            case 2:
                GameMode = gamemode.OttomanEmpire;
                break;

            case 4:
                GameMode = gamemode.LastManSitting;
                break;
            }
        }
        InvokeRepeating("DeathWatch", 0.01f, 1.0f);//Watching for player deaths
    }