void Update()
    {
                #if UNITY_EDITOR
        if (Input.GetKeyDown(KeyCode.B))
        {
            _gameRound = GameRounds.MariachiRound;
        }
                #endif

        if (Input.GetKeyDown(KeyCode.Escape))
        {
            SceneManager.LoadScene(0);
        }

        switch (_gameRound)
        {
        case GameRounds.SacrificeRound:
            StartCoroutine(SacrificeRound());
            break;

        case GameRounds.MariachiRound:
            StartCoroutine(MariachiRound());
            break;

        case GameRounds.None:
            break;
        }
    }
    void Start()
    {
        _amountOfPlayers = InputManager.Instance.ActiveControllers.Length;

        for (int i = 0; i < _amountOfPlayers; i++)
        {
            _players[i].gameObject.SetActive(true);
        }

        for (int i = 0; i < _amountOfPlayers; i++)
        {
            if (!_players[i].gameObject.activeInHierarchy)
            {
                _players.Remove(_players[i]);
                Destroy(_players[i].gameObject);
            }
        }
        _gameRound = GameRounds.SacrificeRound;
    }
 private IEnumerator SacrificeRound()
 {
     if (!_itemHasSpawned && _timesSkullHasSpawned <= 5)
     {
         int r = Random.Range(0, 4);
         SpawnSkull(r);
         _itemHasSpawned = true;
         _timesSkullHasSpawned++;
     }
     else if (_timesSkullHasSpawned > 5)
     {
         foreach (Player p in _players)
         {
             p.Reset();
         }
         _gameRound = GameRounds.MariachiRound;
     }
     yield return(null);
 }
 public void NextGameRound()
 {
     foreach (Player p in _players)
     {
         p.Reset();
     }
     _audioSource.Stop();
     _audioSource.clip = gameMusic.sacrificeRoundMusic;
     _audioSource.Play();
     _itemHasSpawned       = false;
     _timesSkullHasSpawned = 0;
     _altar.Reset();
     if (_skullsInField.Count > 0)
     {
         foreach (GameObject g in _skullsInField)
         {
             Destroy(g);
         }
         _skullsInField.Clear();
     }
     _mariachiHasSpawned = false;
     _gameRound          = GameRounds.SacrificeRound;
 }
 public void AdvanceGameRound(GameRounds roundToGo)
 {
     _gameRound = roundToGo;
 }
示例#6
0
 private void NextRound()
 {
     GameRounds.Add(new GameRound());
 }
示例#7
0
        private static GameRounds InputGameRounds(MyDBContext context)
        {
            GameRounds gameRounds;

            Games games = findGame(context);

            Console.Write("What round number are you at?: ");
            int roundNum = Convert.ToInt32(Console.ReadLine());

            Console.Write("What type of round are you playing (sole/normal): ");
            string round = Console.ReadLine();

            Console.Write("Is the round started (yes/no): ");
            string yesNo   = Console.ReadLine();
            bool   started = YesNo(yesNo);

            Console.Write("Is the round ended (yes/no): ");
            string E_yesNo = Console.ReadLine();
            bool   ended   = YesNo(E_yesNo);


            if (round == "sole")
            {
                //Add Type: SoleRound
                Console.Write("What solo type is this?: ");
                string    soloType  = Console.ReadLine();
                SoleRound soleRound = new SoleRound()
                {
                    SoloType = soloType
                };
                context.SoleRound.Add(soleRound);
                gameRounds = new GameRounds()
                {
                    Types    = soleRound,
                    RoundNum = roundNum,
                    Started  = started,
                    Ended    = ended,
                    Games    = games,
                };
                //Add SoleRoundWinner
                Console.WriteLine("How many sole round winners are there?");
                int number = Convert.ToInt32(Console.ReadLine());

                gameRounds.SoleRoundWinnerList = new List <SoleRoundWinner>();
                for (int i = 0; i < number; i++)
                {
                    Console.Write($"What is the trick for winner {i + 1}?: ");
                    int             trick           = Convert.ToInt32(Console.ReadLine());
                    SoleRoundWinner soleRoundWinner = new SoleRoundWinner()
                    {
                        GameRound = gameRounds,
                        Tricks    = trick
                    };
                    context.SoleRoundWinner.Add(soleRoundWinner);
                }
            }
            else
            {
                //Add Type: NormalRound
                Console.Write("What is the trick?: ");
                int trick = Convert.ToInt32(Console.ReadLine());

                Console.Write("What is the bid attachment?:");
                int bidAttachment = Convert.ToInt32(Console.ReadLine());

                Console.Write("What is the bid tricks?:");
                int bidTricks = Convert.ToInt32(Console.ReadLine());

                NormalRound normalRound = new NormalRound()
                {
                    Tricks        = trick,
                    BidAttachment = bidAttachment,
                    BitTricks     = bidTricks
                };
                context.NormalRound.Add(normalRound);

                gameRounds = new GameRounds()
                {
                    Types    = normalRound,
                    RoundNum = roundNum,
                    Started  = started,
                    Ended    = ended,
                    Games    = games,
                };
            }
            //Add GameRoundPlayers
            Console.WriteLine("Add points your game round players: ");
            gameRounds.GameRoundPlayersList = new List <GameRoundPlayers>();
            for (int i = 0; i < 4; i++)
            {
                Console.Write($"Player {i + 1}'s points: ");
                int points = Convert.ToInt32(Console.ReadLine());
                GameRoundPlayers gameRoundPlayers = new GameRoundPlayers()
                {
                    Points     = points,
                    GameRounds = gameRounds
                };
                context.GameRoundPlayers.Add(gameRoundPlayers);
            }

            return(gameRounds);
        }
示例#8
0
        static void Main(string[] args)
        {
            Console.WriteLine("Hello Whist game players!");

            using (var context = new MyDBContext())
            {
                Console.WriteLine("Keep track of your games by using the WhistApp!");
                Console.WriteLine("Usage:");
                Console.WriteLine("If this is your first time using the WhistApp, please follow these steps:");
                Console.WriteLine("Step 1: Add Players (type p)");
                Console.WriteLine("Step 2: Add Game (type g)");
                Console.WriteLine("Step 3: Connect Players to Game (type c)");
                Console.WriteLine("Step 4: Add Game Rounds (type r)");
                Console.WriteLine("---------------------------------------------------------------");
                Console.WriteLine("See lists of already played games:");
                Console.WriteLine("Option 1: See list of Games (type gl)");
                Console.WriteLine("Option 2: See list of Games with players (type gp)");
                Console.WriteLine("Option 3: See list of Games round players and points (type gr)");
                Console.WriteLine("Option 4: See list of player ids (type pl)");

                while (true)
                {
                    Console.WriteLine("Type command");
                    string line = Console.ReadLine();

                    switch (line)
                    {
                    case "p":
                        Players players = InputPlayer();
                        context.Players.Add(players);
                        context.SaveChanges();
                        break;

                    case "g":
                        Games games = InputGames(context);
                        context.Games.Add(games);
                        context.SaveChanges();
                        break;

                    case "r":
                        if (context.Games.Count() == 0)
                        {
                            Console.WriteLine("No games exist!");
                            break;
                        }
                        else
                        {
                            GameRounds gameRounds = InputGameRounds(context);
                            context.GameRounds.Add(gameRounds);
                            context.SaveChanges();
                        }
                        break;

                    case "c":
                        if (context.Games.Count() == 0)
                        {
                            Console.WriteLine("No games exist!");
                            break;
                        }
                        else if (context.Players.Count() == 0)
                        {
                            Console.WriteLine("No players exist!");
                            break;
                        }
                        else
                        {
                            GamePlayers gamePlayers = InputGamePlayers(context);
                            context.GamePlayers.Add(gamePlayers);
                            context.SaveChanges();
                        }
                        break;

                    case "gp":
                        ListGamePlayers(context);
                        break;

                    case "gl":
                        ListGames(context);
                        break;

                    case "gr":
                        ListGameRoundPlayers(context);
                        break;

                    case "pl":
                        ListPlayers(context);
                        break;

                        //Mangler lister
                    }
                }
            }
        }
示例#9
0
 public void DefineRoundLimit(GameRounds limit)
 {
     roundLimit = limit.Equals(GameRounds.ROUND_LIMIT_3) ? 3 : (
         limit.Equals(GameRounds.ROUND_LIMIT_5) ? 5 : 7);
 }