Пример #1
0
        // her player in kullanacagi board i da almamiz gerek. ya da bu bilgiyi user dan cekebiliriz.   TODO
        /// <summary>
        /// Userlari kullanarak playerlar olusturur. Bu userlar icin setState(GAME) fonksiyonunu cagirir.
        /// GameState i ReadyWait e setler.
        /// </summary>
        /// <param name="users"></param>
        public Game(List<User> users)
        {
            foreach (User user in users)
            {
                Player pTemp = new Player(user, this );
                players.AddLast(pTemp);
                statPlayers.Add(pTemp);
                user.player = pTemp;
            }

            remainingPlayerCount += users.Count;

            float distance = calculateBoardDistanceToCenter(users.Count);

            for (int i=0; i<users.Count; i++)
            {
                Vector3 rotation = new Vector3(0, i * 360.0f / users.Count, 0);
                users[i].player.board.rotation = rotation;
                users[i].player.board.position = new Vector3((float)Math.Cos(-1*rotation.y * (Math.PI / 180.0)) * distance, 0, (float) (Math.Sin(-1*rotation.y * (Math.PI / 180.0)) * distance));
                users[i].player.board.nextBoard = users[(i + 1)%users.Count].player.board;
                users[i].player.board.prevBoard = users[(i + users.Count - 1) % users.Count].player.board;
            }

            this.statTracker = new StatTracker(this);

            setStateReadyWait();
        }
Пример #2
0
 public void removePlayer(Player player)
 {
     player.decreaseHealth( player.healthPoints );
     player.user.setState(User.UserState.LOBBY);
     remainingPlayerCount--;
 }