Ejemplo n.º 1
0
 private void Awake()
 {
     for (int i = 0; i < 3; i++)
     {
         GameObject playerInst = GameObject.Instantiate(playerPrefab);
         playerInst.transform.SetParent(playerPrefabParent.transform);
         var enmPlayerId = PlayerIdExtensions.FromInt(i + 1);
         if (i < 3)
         {
             playerInst.transform.localPosition = new Vector3(i * 108 - 108, 123, 3);
         }
         else
         {
             playerInst.transform.localPosition = new Vector3((i - 3) * 108 - 108, -53, 3);
         }
         playerArray[i]               = playerInst.GetComponent <PlayerController>();
         playerArray[i].IdText.text   = enmPlayerId.ToName();
         playerArray[i].VotedNum.text = "0";
     }
 }
Ejemplo n.º 2
0
        public void StartGame()
        {
            gameManager = new GameManager(logic);
            gameManager.SetWerewolfIndex();
            PlayerModel[] playerModelArray = new PlayerModel[3];
            int           wereWolfIndex    = gameManager.GetWerewolfIndex();

            for (int i = 0; i < 3; i++)
            {
                var enmPlayerId = PlayerIdExtensions.FromInt(i + 1);
                playerModelArray[i] = new PlayerModel(enmPlayerId, i == wereWolfIndex ? EnumRole.Werewolf : EnumRole.Citizen);
            }
            GameViewController.SetPlayers(playerModelArray, gameManager);
            gameManager.StartGame(() => timer = 0);
            StartCoroutine(CountUpCoroutine());
//			GameViewController.SetVote(PlayerId.Player1, PlayerId.Player2);
//			GameViewController.SetVote(PlayerId.Player2, PlayerId.Player1);
//			GameViewController.SetVotedNum(PlayerId.Player1, 3);
//			GameViewController.SetVotedNum(PlayerId.Player2, 1);
        }