コード例 #1
0
 void CheckAll()
 {
     foreach (GameObject Slot in EmptySlots)
     {
         EmptyTileSlot Temp = Slot.GetComponent <EmptyTileSlot>();
         Debug.Log(Temp.MatrixMark[0]);
     }
 }
コード例 #2
0
    void CreateSlotsAfterSettingTile(int x, int y) //Принимает матричные координаты
    {
        bool Left  = true;
        bool Right = true;
        bool Up    = true;
        bool Down  = true;

        foreach (GameObject Slot in EmptySlots)
        {
            EmptyTileSlot Temp = Slot.GetComponent <EmptyTileSlot>();
            if ((Temp.MatrixMark[0] == x) && (Temp.MatrixMark[1] == y - 1) || (GamingBoard.GamingBoard[(x * 5 + 2), (y * 5 + 2) - 5] != 0))
            {
                Left = false;
            }
            if ((Temp.MatrixMark[0] == x) && (Temp.MatrixMark[1] == y + 1) || (GamingBoard.GamingBoard[(x * 5 + 2), (y * 5 + 2) + 5] != 0))
            {
                Right = false;
            }
            if ((Temp.MatrixMark[0] == x - 1) && (Temp.MatrixMark[1] == y) || (GamingBoard.GamingBoard[(x * 5 + 2) - 5, (y * 5 + 2)] != 0))
            {
                Up = false;
            }
            if ((Temp.MatrixMark[0] == x + 1) && (Temp.MatrixMark[1] == y) || (GamingBoard.GamingBoard[(x * 5 + 2) + 5, (y * 5 + 2)] != 0))
            {
                Down = false;
            }
        }
        if (Left == true)
        {
            EmptyTileSlot Temp = EmptySlot.GetComponent <EmptyTileSlot>();
            Temp.SetMark(x, y - 1);
            EmptySlot.transform.position = new Vector3((y - 1 - Center) * SizeOfTile, -(x - Center) * SizeOfTile, 0.0f);
            EmptySlots.Add(Instantiate(EmptySlot));
        }
        if (Right == true)
        {
            EmptyTileSlot Temp = EmptySlot.GetComponent <EmptyTileSlot>();
            Temp.SetMark(x, y + 1);
            EmptySlot.transform.position = new Vector3((y + 1 - Center) * SizeOfTile, -(x - Center) * SizeOfTile, 0.0f);
            EmptySlots.Add(Instantiate(EmptySlot));
        }
        if (Up == true)
        {
            EmptyTileSlot Temp = EmptySlot.GetComponent <EmptyTileSlot>();
            Temp.SetMark(x - 1, y);
            EmptySlot.transform.position = new Vector3((y - Center) * SizeOfTile, -(x - 1 - Center) * SizeOfTile, 0.0f);
            EmptySlots.Add(Instantiate(EmptySlot));
        }
        if (Down == true)
        {
            EmptyTileSlot Temp = EmptySlot.GetComponent <EmptyTileSlot>();
            Temp.SetMark(x + 1, y);
            EmptySlot.transform.position = new Vector3((y - Center) * SizeOfTile, -(x + 1 - Center) * SizeOfTile, 0.0f);
            EmptySlots.Add(Instantiate(EmptySlot));
        }
    }
コード例 #3
0
 void TileAlwaysFallowToActiveSlot()
 {
     foreach (GameObject Slot in EmptySlots)
     {
         EmptyTileSlot Temp = Slot.GetComponent <EmptyTileSlot>();
         if (Temp.MouseOnMe == true)
         {
             //Debug.Log("I want to be here");
             ActiveTile.transform.position = Slot.transform.position;
             ActiveTile.transform.Translate(0, 0, 1);
         }
     }
 }
コード例 #4
0
 void SetTileOnActiveSlot()
 {
     for (int i = 0; i < EmptySlots.Count; i++)
     {
         EmptyTileSlot Temp = EmptySlots[i].GetComponent <EmptyTileSlot>();
         if (Temp.MouseOnMe == true)
         {
             if (GamingBoard.MatchingCheck(ActiveTile, Temp.MatrixMark[0], Temp.MatrixMark[1]) == true)
             {
                 GamingBoard.SetTileOnBoard(ActiveTile, Temp.MatrixMark[0], Temp.MatrixMark[1]);
                 LastSloteMarks[0] = Temp.MatrixMark[0];
                 LastSloteMarks[1] = Temp.MatrixMark[1];
                 Destroy(EmptySlots[i]);
                 EmptySlots.RemoveAt(i);
                 CreateSlotsAfterSettingTile(Temp.MatrixMark[0], Temp.MatrixMark[1]);
                 MakeMeepSlots();
                 GameWaitingForMeep = true;
                 //TakeTileFromBox();
             }
         }
     }
 }