Beispiel #1
0
 public GridModel()
 {
     m_Cells = new CellItem[kCellCount];
     for (int i = 0; i < m_Cells.Length; i++)
     {
         m_Cells[i] = new CellItem(i);
     }
 }
Beispiel #2
0
 //Visually change state of cell, set texture on Quad object or diactivate when no texture
 public void SetState(CellItem cellItem)
 {
     if (cellItem.state == CellState.xFilled)
     {
         m_CellViews[cellItem.index].SetTexture(m_XTexture);
     }
     else if (cellItem.state == CellState.oFilled)
     {
         m_CellViews[cellItem.index].SetTexture(m_OTexture);
     }
     else
     {
         m_CellViews[cellItem.index].SetTexture(null);
     }
 }
Beispiel #3
0
 private bool IsPlayerCell(CellItem cellItem)
 {
     if (cellItem.state == CellState.xFilled)
     {
         if (playerSing == SignType.X)
         {
             return(true);
         }
     }
     else if (cellItem.state == CellState.oFilled)
     {
         if (playerSing == SignType.O)
         {
             return(true);
         }
     }
     return(false);
 }
 public CellItemChangedEventData(CellItem cellItem)
 {
     this.cellItem = cellItem;
 }
Beispiel #5
0
 private bool IsEmptyCell(CellItem cellItem)
 {
     return(cellItem.state == CellState.empty);
 }
Beispiel #6
0
 private bool IsEnemyCell(CellItem cellItem)
 {
     return((!IsPlayerCell(cellItem)) && (!IsEmptyCell(cellItem)));
 }