Esempio n. 1
0
    // Start is called before the first frame update
    void Start()
    {
        amountOfPlayers = AmountPlayers.GetAmountOfPlayers();
        switch (amountOfPlayers)
        {
        case 1:
            players[1].gameObject.SetActive(false);
            players[2].gameObject.SetActive(false);
            players[3].gameObject.SetActive(false);
            //players[1] = null;
            //players[2] = null;
            //players[3] = null;
            break;

        case 2:
            players[2].gameObject.SetActive(false);
            players[3].gameObject.SetActive(false);
            //players[2] = null;
            //players[3] = null;
            break;

        case 3:
            players[3].gameObject.SetActive(false);
            //players[3] = null;
            break;

        default:
            break;
        }
        playerInFirst = players[0];
        cameraController.SetPlayerInFirst(playerInFirst);
        GameOver.gameObject.SetActive(false);
    }
        public ViewResult Index(AmountPlayers amtPlayers)
        {
            int amt = 0;

            if (!int.TryParse(amtPlayers.Amt, out amt) || string.IsNullOrEmpty(amtPlayers.Amt) || (amt < 1 || amt > 9))
            {
                ModelState.AddModelError(nameof(amtPlayers.Amt),
                                         "Please enter an amount of players between 1-9");
            }
            if (ModelState.IsValid)
            {
                gameInterface.InitializeInterface(amt);
                gameInterface.dealer.InitialDeal(gameInterface.players);
                return(View("PlayGame", gameInterface));
            }
            else
            {
                return(View());
            }
        }
Esempio n. 3
0
 public void StartGame(int amountOfPlayers)
 {
     AmountPlayers.SetAmountOfPlayers(amountOfPlayers);
     SceneManager.LoadScene(1, LoadSceneMode.Single);
 }