public Player(string i_Name, playerType i_Type, colorType i_Color, bool i_CurrentTurn) { m_CurrentTurn = i_CurrentTurn; m_Name = i_Name; m_Type = i_Type; m_Color = i_Color; }
PictureBox PictureBoxButton(colorType i_Color, int i_IndexButton) { var path = Directory.GetParent(Directory.GetCurrentDirectory()); PictureBox button = new PictureBox(); button.Height = 40; button.Width = 40; button.Click += (sender, args) => button_click(i_IndexButton); if (i_Color == colorType.O) { button.Image = Properties.Resources.CoinRed; button.SizeMode = PictureBoxSizeMode.StretchImage; button.Enabled = false; } else if (i_Color == colorType.X) { button.Image = Properties.Resources.CoinYellow; button.SizeMode = PictureBoxSizeMode.StretchImage; button.Enabled = false; } else if (i_Color == colorType.G) { button.BackColor = System.Drawing.Color.Green; button.Enabled = true; } else { button.Enabled = false; } return(button); }
public void Highlight(Color hilight, Color fillCol) { boxtype = colorType.highlight; Color temp = hilight; this.GetComponent <MeshRenderer>().material.color = temp; this.GetComponent <MeshRenderer>().enabled = true; this.fillColor = fillCol; }
public void SetBoard(Player i_Player, Player i_PlayerRival) { int indexOfColumnStep, endLoop; colorType color = i_Player.Color; int columnStep = i_Player.ColumnStep; int rowStep = i_Player.RowStep; foreach (KeyValuePair <int, int> entry in m_StartSteps) { int i_ColumnStepStart = entry.Key; int i_RowStepStart = entry.Value; if (rowStep == i_RowStepStart) { if (columnStep < i_ColumnStepStart) { endLoop = i_ColumnStepStart; i_Player.CoinsCount += i_ColumnStepStart - columnStep; i_PlayerRival.CoinsCount -= i_ColumnStepStart - columnStep - 1; indexOfColumnStep = columnStep++; } else { endLoop = columnStep; i_Player.CoinsCount += columnStep - i_ColumnStepStart; i_PlayerRival.CoinsCount -= columnStep - i_ColumnStepStart - 1; indexOfColumnStep = i_ColumnStepStart++; } while (indexOfColumnStep <= endLoop) { m_MatrixBoard[rowStep, indexOfColumnStep] = color; indexOfColumnStep++; } } else { if (rowStep < i_RowStepStart) { endLoop = i_RowStepStart; i_Player.CoinsCount += i_RowStepStart - rowStep; i_PlayerRival.CoinsCount -= i_RowStepStart - rowStep - 1; indexOfColumnStep = rowStep++; } else { endLoop = rowStep; i_Player.CoinsCount += rowStep - i_RowStepStart; i_PlayerRival.CoinsCount -= rowStep - i_RowStepStart - 1; indexOfColumnStep = i_RowStepStart++; } while (indexOfColumnStep <= endLoop) { m_MatrixBoard[indexOfColumnStep, columnStep] = color; indexOfColumnStep++; } } } }
private bool checkColumn(int i_RowStart, int i_RowEnd, int i_Column, colorType i_ColorRival) { int startLoop = i_RowStart; bool haveMove = false; if (i_RowStart > i_RowEnd) { while (startLoop >= i_RowEnd && !haveMove) { if (m_MatrixBoard[startLoop, i_Column] == i_ColorRival) { startLoop--; } else if (m_MatrixBoard[startLoop, i_Column] == colorType.nan) { haveMove = true; m_MatrixBoard[startLoop, i_Column] = colorType.G; } else { break; } } } else { while (startLoop < i_RowEnd && !haveMove) { if (m_MatrixBoard[startLoop, i_Column] == i_ColorRival) { startLoop++; } else if (m_MatrixBoard[startLoop, i_Column] == colorType.nan) { haveMove = true; m_MatrixBoard[startLoop, i_Column] = colorType.G; } else { break; } } } return(haveMove); }
private bool checkMovePlayer(int i_Row, int i_Column, colorType i_ColorRival) { bool haveMoves = false; bool checkMove = false; List <direction> directions = new List <direction>(); getSearchingDirections(directions, i_Row, i_Column, m_Size, i_ColorRival); foreach (direction index in directions) { if (index == direction.Up) { checkMove = checkColumn(i_Row - 1, 0, i_Column, i_ColorRival); if (checkMove) { haveMoves = true; } } else if (index == direction.Down) { checkMove = checkColumn(i_Row + 1, m_Size, i_Column, i_ColorRival); if (checkMove) { haveMoves = true; } } else if (index == direction.Right) { checkMove = checkRow(i_Row, i_Column + 1, m_Size, i_ColorRival); if (checkMove) { haveMoves = true; } } else { checkMove = checkRow(i_Row, i_Column - 1, 0, i_ColorRival); if (checkMove) { haveMoves = true; } } } return(haveMoves); }
void Update() { if (GetComponent <DragObject>().dragging) { if (Input.GetKeyDown(KeyCode.Return)) { if (ct == colorType.Red) { ct = colorType.Blue; renderer.materials[2].SetColor("_Color", Color.blue); } else { ct = colorType.Red; renderer.materials[2].SetColor("_Color", Color.red); } } } }
public void Play() { if (MainCharacter.GetComponent <Character>().ObjectUnderFoots == null) { return; } if (CurrentSlot.transform.childCount == 0) { Debug.Log("No Order in the Slot"); StartCoroutine("WaitAndNext", 0); return; } else { CurrentOrder = CurrentSlot.transform.GetChild(0).gameObject; tempfix2 = true; } CurrentCaseColor = CurrentCase.GetComponent <Case>().CaseColor; CurrentOrderColor = CurrentOrder.GetComponent <Button>().BlockColor; Debug.Log("Current Case Color : " + CurrentCaseColor); Debug.Log("Current Action Color : " + CurrentOrderColor); if (CurrentOrderColor == colorType.none) { ExecuteOrder(CurrentOrder.GetComponent <Button>().ButtonType); } else if (CurrentOrderColor == CurrentCaseColor) { ExecuteOrder(CurrentOrder.GetComponent <Button>().ButtonType); } else { Debug.Log("Order Ignored"); StartCoroutine("WaitAndNext", 0); } }
private bool checkLegalLogicalSquer(Player i_Player) { m_StartSteps = new Dictionary <int, int>(); bool findData = false; int row = i_Player.RowStep; int column = i_Player.ColumnStep; int boardSize = m_Size; colorType rivalColor = colorType.O; colorType chosenSquer = GetSquereDate(row, column); if (chosenSquer != colorType.G) { return(false); } if (i_Player.Color == colorType.O) { rivalColor = colorType.X; } List <direction> directions = new List <direction>(); getSearchingDirections(directions, row, column, boardSize, rivalColor); foreach (direction direction in directions) { row = i_Player.RowStep; column = i_Player.ColumnStep; movingOnBoardBasedDirection(direction, ref row, ref column); while ((CheckIfInLimitBoard(row, column) && (GetSquereDate(row, column) == rivalColor))) { movingOnBoardBasedDirection(direction, ref row, ref column); } if ((CheckIfInLimitBoard(row, column)) && (GetSquereDate(row, column) == i_Player.Color)) // finding the relevant squere { m_StartSteps.Add(column, row); findData = true; } } return(findData); }
public void setActiveColor(GameManager.colorType newColorType) { selectedColorType = newColorType; }
public void FillIt() { boxtype = colorType.filled; this.GetComponent <MeshRenderer>().enabled = true; this.GetComponent <MeshRenderer>().material.color = fillColor; }
public void Play() { if (MainCharacter.GetComponent<Character>().ObjectUnderFoots == null) { return; } if (CurrentSlot.transform.childCount == 0) { Debug.Log("No Order in the Slot"); StartCoroutine("WaitAndNext", 0); return; } else { CurrentOrder = CurrentSlot.transform.GetChild(0).gameObject; tempfix2 = true; } CurrentCaseColor = CurrentCase.GetComponent<Case>().CaseColor; CurrentOrderColor = CurrentOrder.GetComponent<Button>().BlockColor; Debug.Log("Current Case Color : " + CurrentCaseColor); Debug.Log("Current Action Color : " + CurrentOrderColor); if (CurrentOrderColor == colorType.none) { ExecuteOrder(CurrentOrder.GetComponent<Button>().ButtonType); } else if (CurrentOrderColor == CurrentCaseColor) { ExecuteOrder(CurrentOrder.GetComponent<Button>().ButtonType); } else { Debug.Log("Order Ignored"); StartCoroutine("WaitAndNext", 0); } }
private Player getDataPlayer(colorType i_color, playerType i_type, bool i_CurrentTurn, bool i_SecondPlayer) { return(new Player(null, i_type, i_color, i_CurrentTurn)); }
private void getSearchingDirections(List <direction> i_Directions, int i_Row, int i_Column, int i_BoardSize, colorType i_ColorRival) { if (i_Row != Utils.Constants.k_MinSquere && GetSquereDate(i_Row - 1, i_Column) == i_ColorRival) { i_Directions.Add(direction.Up); } if (i_Row != (i_BoardSize - 1) && GetSquereDate(i_Row + 1, i_Column) == i_ColorRival) { i_Directions.Add(direction.Down); } if (i_Column != Utils.Constants.k_MinSquere && GetSquereDate(i_Row, i_Column - 1) == i_ColorRival) { i_Directions.Add(direction.Left); } if (i_Column != (i_BoardSize - 1) && GetSquereDate(i_Row, i_Column + 1) == i_ColorRival) { i_Directions.Add(direction.Right); } }
void Start() { renderer = GetComponent <Renderer>(); ct = colorType.Red; }
public static void ShowPlayersColors(string i_FistPlayerName, colorType i_FirstPlayerColor, string i_SecondPlayerName, colorType i_SecondPlayerColor) { Console.WriteLine(); Console.WriteLine(String.Format("{0} you play with: {1}", i_FistPlayerName, i_FirstPlayerColor)); Console.WriteLine(String.Format("{0} you play with: {1}", i_SecondPlayerName, i_SecondPlayerColor)); }