Ejemplo n.º 1
0
        public bool AddPlayer(string sPlayer)
        {
            if (State == EGameState.GameWait)
            {
                LastDateTime = DateTime.Now;
                CPlayer pPlayer = new CPlayer(sPlayer);
                PlayerList.Add(pPlayer);
                if (PlayerList.Count == 2)
                {
                    State = EGameState.GameProcess;
                }
                return(true);
            }

            return(false);
        }
Ejemplo n.º 2
0
        public bool Turn(string sPlayer, ETurn enTurn)
        {
            CPlayer pPl = PlayerList.First(p => p.Guid == sPlayer);

            if (State == EGameState.GameProcess)
            {
                pPl.Turn(enTurn);
                if (pPl.X == ExitX && pPl.Y == ExitY)
                {
                    CurrentPlayer = sPlayer;
                    State         = EGameState.GameOver;
                }

                return(true);
            }

            return(false);
        }