Exemple #1
0
 public PlayerInfo(string sName, ePlayerType eType, eDifficulty eDifficulty)
 {
     nID              = PlayerCnt++;
     this.sName       = sName;
     this.eType       = eType;
     this.eDifficulty = eDifficulty;
 }
Exemple #2
0
        private void handleDeadPlayer(IUpdateGameManager i_UpdatesGameManager, ePlayerType i_PlayerType)
        {
            IPlayer playerToRemove = null;

            i_UpdatesGameManager.ScoreChanged -= updatesGameManager_ScoreChanged;
            i_UpdatesGameManager.GameOver     -= updatesGameManager_GameOver;
            i_UpdatesGameManager.PlayerDown   -= updatesGameManager_PlayerDown;
            if (m_CurrentAlivePlayers == 1)
            {
                m_Players[0].IsDead = true;
                handleGameOverSituation();
            }

            foreach (IPlayer player in m_Players)
            {
                if (player.PlayerType == i_PlayerType)
                {
                    playerToRemove = player;
                    player.IsDead  = true;
                    break;
                }
            }

            m_CurrentAlivePlayers--;
        }
 public BasePlayer(ePlayerType type, int onBoardPieces = 15, int eatenPieces = 0, bool readyToClear = false)
 {
     Type          = type;
     OnBoardPieces = onBoardPieces;
     EatenPieces   = eatenPieces;
     ReadyToClear  = readyToClear;
 }
Exemple #4
0
 public Player(string i_Name, ePlayerType i_Type, bool i_IsPlayersTurn)
 {
     this.m_PlayerName = i_Name;
     this.m_Points     = 0;
     this.m_IsMyTurn   = i_IsPlayersTurn;
     this.m_PlayerType = i_Type;
 }
Exemple #5
0
    GameObject CreatePlayer(ePlayerType type)
    {
        GameObject go = null;

        switch (type)
        {
        case ePlayerType.None:
            break;

        case ePlayerType.Programmer:
            go = Instantiate(m_CloneProgrammer);
            break;

        case ePlayerType.Planner:
            go = Instantiate(m_ClonePlanner);
            break;

        case ePlayerType.Artist:
            go = Instantiate(m_CloneArtist);
            break;

        case ePlayerType.Boss:
            go = Instantiate(m_CloneBoss);
            break;

        default:
            break;
        }

        return(go);
    }
Exemple #6
0
 public Player(ePlayerType i_PlayerType, eSign i_Sign, string i_PlayerName)
 {
     m_PlayerType  = i_PlayerType;
     m_Sign        = i_Sign;
     m_PlayerName  = i_PlayerName;
     m_NumOfTokens = 0;
 }
Exemple #7
0
        public ePlayerType GetPlayerType()
        {
            printMessage(Strings.ChoosePlayer);
            string      userInput         = getInputFromUser().ToLower();
            bool        validPlayerType   = false;
            ePlayerType choosenPlayerType = ePlayerType.Human;

            while (!validPlayerType)
            {
                if (userInput == k_ComputerSymbol.ToString())
                {
                    choosenPlayerType = ePlayerType.Computer;
                    validPlayerType   = true;
                }
                else if (userInput == k_HumenSymbol.ToString())
                {
                    choosenPlayerType = ePlayerType.Human;
                    validPlayerType   = true;
                }
                else
                {
                    printMessage(Strings.InvalidPlayerType);
                    userInput = getInputFromUser();
                }
            }

            return(choosenPlayerType);
        }
Exemple #8
0
        private bool checkValidInput(string i_ChoiceStr, ePlayerType i_PlayerType)
        {
            bool isValid = true;
            int  chosenRow, chosenCol;

            if (i_ChoiceStr[0] == 'Q' && i_ChoiceStr.Length == 1)
            {
                Environment.Exit(1);
            }

            strInputToIndexes(i_ChoiceStr, out chosenRow, out chosenCol);
            if (i_PlayerType != ePlayerType.computer)
            {
                checkRange(chosenRow, chosenCol, ref isValid);
                if (isValid)
                {
                    if (checkBoardCellState(chosenRow, chosenCol))
                    {
                        Console.WriteLine("This cell is already open! please choose again:");
                        isValid = false;
                    }
                }
            }
            else
            {
                isValid = !checkBoardCellState(chosenRow, chosenCol);
            }

            return(isValid);
        }
Exemple #9
0
        private void passTurn(ref ePlayerType i_PlayerType)
        {
            switch (i_PlayerType)
            {
            case ePlayerType.playerOne:
                if (m_SecondPlayer == null)
                {
                    i_PlayerType = ePlayerType.computer;
                }
                else
                {
                    i_PlayerType = ePlayerType.playerTwo;
                }

                break;

            case ePlayerType.playerTwo:
                i_PlayerType = ePlayerType.playerOne;
                break;

            case ePlayerType.computer:
                i_PlayerType = ePlayerType.playerOne;
                break;
            }
        }
Exemple #10
0
        public void AddGameScore(
            int i_BlackScore,
            int i_WhiteScore,
            ePlayerType i_BlackPlayer,
            ePlayerType i_WhitePlayer)
        {
            BlackScore += i_BlackScore;
            WhiteScore += i_WhiteScore;

            if (i_BlackScore > i_WhiteScore)
            {
                BlackWins++;
            }
            else if (i_BlackScore < i_WhiteScore)
            {
                WhiteWins++;
            }
            else
            {
                BnWDraws++;
            }

            if ((i_BlackPlayer == ePlayerType.Human || i_WhitePlayer == ePlayerType.Human) &&
                i_BlackPlayer != i_WhitePlayer)
            {
                updateVsComputerWins(i_BlackScore, i_WhiteScore, i_BlackPlayer, i_WhitePlayer);
                updateVsComputerScore(i_BlackScore, i_WhiteScore, i_BlackPlayer);
            }
        }
Exemple #11
0
    void initByPlayerType(ePlayerType type)
    {
        switch (type)
        {
        case ePlayerType.Programmer:
            Color = eColor.Blue;
            break;

        case ePlayerType.Planner:
            Color = eColor.Yellow;
            break;

        case ePlayerType.Artist:
            Color = eColor.Red;
            break;

        case ePlayerType.Boss:
            Color = eColor.None;
            break;

        case ePlayerType.None:
            break;

        default:
            break;
        }
    }
 public Player(Player i_Other)
 {
     this.r_PlayerName   = i_Other.r_PlayerName;
     this.r_PlayerType   = i_Other.r_PlayerType;
     this.r_PlayerNumber = i_Other.r_PlayerNumber;
     this.r_PlayerColor  = i_Other.r_PlayerColor;
     this.m_PlayerScore  = i_Other.m_PlayerScore;
 }
 public Player(string i_PlayerName, ePlayerType i_PlayerType, ePlayerNumber i_PlayerNumber, ePlayerColor i_PlayerColor, int i_PlayerScore = k_InitialScore)
 {
     r_PlayerName   = i_PlayerName;
     r_PlayerType   = i_PlayerType;
     r_PlayerNumber = i_PlayerNumber;
     m_PlayerScore  = i_PlayerScore;
     r_PlayerColor  = i_PlayerColor;
 }
Exemple #14
0
 public Player()
 {
     m_PlayerName = "Black Player";
     m_PlayerType = ePlayerType.Human;
     m_Score      = 0;
     m_DiskColor  = eKindOfCell.Black;
     m_AvailableMovesForPlayer = new List <PickedCell>();
 }
Exemple #15
0
 public Player(string i_Name)
 {
     m_Name = i_Name;
     if (i_Name != "COMPUTER")
     {
         e_PlayerType = ePlayerType.Person;
     }
 }
Exemple #16
0
 public Player()
 {
     m_PlayerName = "Black Player";
     m_PlayerType = ePlayerType.Human;
     m_Score = 0;
     m_DiskColor = eKindOfCell.Black;
     m_AvailableMovesForPlayer = new List<PickedCell>();
 }
Exemple #17
0
 // Methods
 internal Player(ePlayerID i_ID, ePlayerType i_Type, string i_Name, int i_NumberOfPawns)
 {
     m_ID            = i_ID;
     m_Type          = i_Type;
     m_Name          = i_Name;
     m_PawnList      = new List <Pawn>(i_NumberOfPawns);
     m_LegalJumpList = new List <LegalJump>();
 }
 internal Player(eShapeType shape, string PlayerName, ePlayerType i_PlayerType)
 {
     this.m_Shape      = shape;
     this.m_PlayerName = PlayerName;
     v_JumpTurn        = false;
     this.m_PlayerType = i_PlayerType;
     this.m_Points     = 0;
 }
 public FourInARowLogic(int i_BoradLength, int i_BoradWidth, ePlayerType player1Type, ePlayerType player2Type)
 {
     m_RowsNumber  = i_BoradLength;
     m_ColsNumber  = i_BoradWidth;
     m_Player1     = new Player(player1Type);
     m_Player2     = new Player(player2Type);
     m_BoardMatrix = new eBoardSign [i_BoradLength, i_BoradWidth];
 }
Exemple #20
0
    Vector3 GetBirtPositionByPlayerType(ePlayerType type)
    {
        Vector3 pos = Vector3.zero;

        m_posDic.TryGetValue(type, out pos);

        return(pos);
    }
Exemple #21
0
 public Player(eShapeType i_Shape, string i_PlayerName, ePlayerType i_PlayerType)
 {
     this.m_Shape      = i_Shape;
     this.m_PlayerName = i_PlayerName;
     v_JumpTurn        = false;
     this.m_PlayerType = i_PlayerType;
     this.m_Points     = 0;
 }
Exemple #22
0
 public Player(string i_Name, eDirection i_Direction, ePlayerType i_Type, byte i_NumberOfTools, char i_ToolsSign)
 {
     m_Name      = i_Name;
     m_Direction = i_Direction;
     m_Type      = i_Type;
     m_Tools     = new Tool[i_NumberOfTools];
     m_ToolsSign = i_ToolsSign;
 }
Exemple #23
0
 public PlayerSouls(Game i_Game, Color i_TintColor, ePlayerType i_PlayerType, int i_Index)
     : base(i_Game, k_AssetName)
 {
     AssetName    = k_AssetName;
     TintColor    = i_TintColor;
     m_PlayerType = i_PlayerType;
     m_Index      = i_Index;
     Scales       = new Vector2(0.5f);
 }
Exemple #24
0
 public Player(string i_name, ePlayerType i_TypeOfPlayer, int i_Score, eSquareType i_PieceSymbol, eSquareType i_KingSymbol, bool i_MovesDown)
 {
     this.m_Name         = i_name;
     this.m_Score        = i_Score;
     this.m_TypeOfPlayer = i_TypeOfPlayer;
     this.m_PieceSymbol  = i_PieceSymbol;
     this.m_KingSymbol   = i_KingSymbol;
     this.m_MovesDown    = i_MovesDown;
 }
Exemple #25
0
 public Player(ePlayerType i_PlayerType, Square.ePlayerColor i_PlayerColor, string i_Name, int i_Score)
 {
     m_PlayerType          = i_PlayerType;
     m_PlayerColor         = i_PlayerColor;
     m_Name                = i_Name;
     m_Score               = i_Score;
     m_PlayerSquares       = new List <Square>();
     m_PlayerRegularMoves  = new List <Move>();
     m_PlayerSkippingMoves = new List <Move>();
 }
Exemple #26
0
        public Player(ePlayerType i_Type = ePlayerType.Computer)
        {
            if (i_Type == ePlayerType.Computer)
            {
                m_Name = "Robot";
            }

            m_Score = 0;
            m_Type  = i_Type;
        }
Exemple #27
0
 public PlayerSoul(Game i_Game, Color i_TintColor, ePlayerType i_PlayerType, int i_Index)
     : base(i_Game, k_AssetName)
 {
     AssetName    = k_AssetName;
     TintColor    = i_TintColor;
     m_PlayerType = i_PlayerType;
     m_Index      = i_Index;
     LayerDepth   = 0.5f;
     Scales       = new Vector2(0.5f);
     i_Game.Components.Add(this);
 }
        /*
         * Initial start up of values at game beginning.
         */
        public static void Init()
        {
            initPlayers();
            initBoard();

            // Determine player2 type and act accordingly
            ePlayerType ePlayerOrPc = getPlayer2Type();
            
            switch (ePlayerOrPc);

        }
Exemple #29
0
        internal Player(string i_PlayerName, ePlayerType i_PlayerType)
        {
            r_Name  = i_PlayerName;
            r_Type  = i_PlayerType;
            m_Score = 0;

            if (i_PlayerType == ePlayerType.Computer)
            {
                m_ComputerMemory = new Dictionary <char, GameCell>();
            }
        }
Exemple #30
0
 // Constructors:
 public User(string i_Name, ePlayerType i_PlayerNumber, bool i_IsComputer)
 {
     m_Name             = i_Name;
     m_Score            = 0;
     m_CheckersPiece    = null;
     m_PlayerNumber     = i_PlayerNumber;
     m_CheckerPieceKind = i_PlayerNumber == ePlayerType.MainPlayer ?
                          CheckersPiece.ePieceKind.MainPlayerTool : CheckersPiece.ePieceKind.SecondPlayerTool;
     m_Moves = null;
     m_CurrentCheckerPiece = null;
     m_IsComputer          = i_IsComputer;
 }
Exemple #31
0
 public static void InitalizeGame(string i_Player1Name, string i_Player2Name, bool i_IsComputer, int i_Rows, int i_Cols) // Initialize the game from start or restart
 {
     Board = new BoardManager(i_Rows, i_Cols);
     if (s_IsTheFirstGame)
     {
         Player1 = new Player(i_Player1Name, ePlayerType.Human, ePlayerNumber.Player1);
         ePlayerType i_OpponentType = i_IsComputer ? ePlayerType.Computer : ePlayerType.Human;
         Player2 = new Player(i_Player2Name, i_OpponentType, ePlayerNumber.Player2);
     }
     CurrentPlayer    = Player1;
     s_IsTheFirstGame = false;
 }
Exemple #32
0
        private void getMove(out int o_Row, out int o_Col, ePlayerType i_PlayerType)
        {
            switch (i_PlayerType)
            {
            case ePlayerType.computer:
                getComputerMove(out o_Row, out o_Col, i_PlayerType);
                break;

            default:
                getPlayerMove(out o_Row, out o_Col, i_PlayerType);
                break;
            }
        }
Exemple #33
0
 public Player(ePlayerType i_PlayerType, eKindOfCell i_DiskColor)
 {
     m_PlayerType = i_PlayerType;
     m_DiskColor = i_DiskColor;
     m_Score = 0;
     m_AvailableMovesForPlayer = new List<PickedCell>();
     if (PlayerType == ePlayerType.Human)
     {
         m_PlayerName = string.Format("{0} Player", DiskColor.ToString());
     }
     else
     {
         m_PlayerName = "Computer";
     }
 }
Exemple #34
0
        public static IPlayer createPlayerOfType(ePlayerType i_PlayerType)
        {
            IPlayer player = null;
            switch (i_PlayerType)
            {
                case ePlayerType.Human:
                    player = new HumanPlayer();
                    break;
                case ePlayerType.DumbComputer:
                    player = new ComputerPlayer();
                    break;
                case ePlayerType.OkComputer:
                    player = createSmartPlayerWithSearchDepthOf(0);
                    break;
                case ePlayerType.SmartComputer:
                    player = createSmartPlayerWithSearchDepthOf(2);
                    break;
                case ePlayerType.GeniusComputer:
                    player = createSmartPlayerWithSearchDepthOf(4);
                    break;
            }

            return player;
        }
Exemple #35
0
 public void SetWhitePlayerAs(ePlayerType i_PlayerType)
 {
 }
Exemple #36
0
 public void SetBlackPlayerAs(ePlayerType i_PlayerType)
 {
 }
Exemple #37
0
 private void updatePlayerWins(ePlayerType player)
 {
     if (player == ePlayerType.Human)
     {
         HumanWins++;
     }
     else
     {
         ComputerWins++;
     }
 }
Exemple #38
0
 private void setWhitePlayerAs(ePlayerType i_PlayerType)
 {
     CommandCommander.GetInstance().GetCommand(m_WPlayerToCommand[i_PlayerType]).DoCommand();
 }
Exemple #39
0
        public void SetWhitePlayerAs(ePlayerType i_PlayerType)
        {
            var currentPlayerCommand = m_WPlayerToCommand[OthelloData.GetInstance().OthelloOptions.WhitePlayer];
            CommandCommander.GetInstance().GetCommand(currentPlayerCommand).Checked = false;
            CommandCommander.GetInstance().GetCommand(m_WPlayerToCommand[i_PlayerType]).Checked = true;

            OthelloData.GetInstance().OthelloOptions.WhitePlayer = i_PlayerType;
            r_BoardController.UpdatePlayers();
        }
Exemple #40
0
 // C'tor
 public Player(string i_Name, ePlayerType i_PlayerType, Coin.eCoinType i_CoinType)
 {
     this.m_Name = i_Name;
     this.m_PlayerType = i_PlayerType;
     this.m_PlayerCoinType = i_CoinType;
 }
 public Player(string i_Name, ePlayerType i_PlayerType)
 {
     m_Name = i_Name;
     m_Type = i_PlayerType;
 }
Exemple #42
0
 private void updateVsComputerScore(int i_BlackScore, int i_WhiteScore, ePlayerType i_BlackPlayer)
 {
     if (i_BlackPlayer == ePlayerType.Human)
     {
         HumanScore += i_BlackScore;
         CompuerScore += i_WhiteScore;
     }
     else
     {
         CompuerScore += i_BlackScore;
         HumanScore += i_WhiteScore;
     }
 }
 public Player(Player.ePlayerType i_PlayerType)
 {
     m_Type = i_PlayerType;
 }
        private void buttonGameOpponent_Click(object sender, EventArgs e)
        {
            if (sender == m_ButtonPlayAgainstComputer)
            {
                m_PlayerType = ePlayerType.Computer;
            }
            else
            {
                m_PlayerType = ePlayerType.Human;
            }

            this.Close();
        }
Exemple #45
0
 private void updateVsComputerWins(
     int i_BlackScore,
     int i_WhiteScore,
     ePlayerType i_BlackPlayer,
     ePlayerType i_WhitePlayer)
 {
     if (i_BlackScore > i_WhiteScore)
     {
         updatePlayerWins(i_BlackPlayer);
     }
     else if (i_BlackScore < i_WhiteScore)
     {
         updatePlayerWins(i_WhitePlayer);
     }
     else
     {
         HnCDraws++;
     }
 }