Beispiel #1
0
        private bool MatchInDiagonal(MakerType maker)
        {
            for (int i = 0; i < 3; i++)
            {
                int counter = 0;
                if (Board.Cells[i, i].MakerType == maker)
                {
                    counter++;
                }
                if (counter == 3)
                {
                    return(true);
                }
            }

            for (int i = 0; i < 3; i++)
            {
                int counter = 0;
                if (Board.Cells[2 - i, i].MakerType == maker)
                {
                    counter++;
                }
                if (counter == 3)
                {
                    return(true);
                }
            }

            return(false);
        }
Beispiel #2
0
 private bool HasMatch(MakerType marker)
 {
     if (MatchInRows(marker) || MatchInColumns(marker) || MatchInDiagonal(marker))
     {
         return(true);
     }
     return(false);
 }
Beispiel #3
0
        public void SetMarker(int x, int y, MakerType makerType)
        {
            if (!CanSetMarker(x, y))
            {
                throw new Exception("Marker aleready set to this Cell");
            }

            if (makerType == MakerType.None)
            {
                throw new Exception("Can not set MakerType.None");
            }

            Cells[x, y].MakerType = makerType;
        }
Beispiel #4
0
 private bool MatchInColumns(MakerType maker)
 {
     for (int j = 0; j < 3; j++)
     {
         int counter = 0;
         for (int i = 0; i < 3; i++)
         {
             if (Board.Cells[i, j].MakerType == maker)
             {
                 counter++;
             }
             if (counter == 3)
             {
                 return(true);
             }
         }
     }
     return(false);
 }
    void SetPopUpTexture(MakerType type, MakerSize size)
    {
        //表示するテキストが存在しない
        if (size == MakerSize.None)
        {
            return;
        }
        if (size == MakerSize.LL)
        {
            size = MakerSize.L;
        }

        //Lに変換
        if (type == MakerType.None)
        {
            type = MakerType.Y;
        }
        int index = ((int)type * (int)MakerType.None) + (int)size;

        transform.GetChild(0).GetComponent <Image>().sprite = MapManager.I.balloonImageList[index];
    }
Beispiel #6
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="v"></param>
 /// <returns></returns>
 public static string ToString(MakerType v)
 {
     return(Enum.GetName(typeof(MakerType), v).ToLowerInvariant());
 }
Beispiel #7
0
 public Game(Board board, MakerType currentMarker)
 {
     this.Status        = new GameStatus();
     this.CurrentMarker = currentMarker;
     Board = board;
 }