コード例 #1
0
 public void RemoveLetterButton(LetterButton letterButton)
 {
     if (ContainsLetterButton(letterButton))
     {
         LetterSlot slot = GetSlotContainingLetterButton(letterButton);
         slot.ClearSlot();
     }
 }
コード例 #2
0
    //Add a tile to the first empty slot
    public void AddLetterButtonToFirstEmptySlot(LetterButton letterButton)
    {
        LetterSlot emptySlot = GetFirstEmptySlot();

        if (emptySlot != null)
        {
            emptySlot.AddToSlot(letterButton);
        }
    }
コード例 #3
0
 //Looping over array to find element.  V.inefficient.  IndexOf works with Android?
 //Remove tile from a specific slot
 public void RemoveTileFromSlot(LetterButton letterButton, LetterSlot letterSlot)
 {
     if (ContainsLetterButton(letterButton) && ContainsSlot(letterSlot))
     {
         if (letterSlot.LetterButton == letterButton)
         {
             letterSlot.ClearSlot();
         }
     }
 }
コード例 #4
0
 //Add a tile to a specific slot
 //Checks if slot is in rack, that slot is empty then adds tile
 public void AddTileToSlot(LetterButton letterButton, LetterSlot letterSlot)
 {
     if (ContainsSlot(letterSlot))
     {
         if (!letterSlot.IsOccupied)
         {
             letterSlot.AddToSlot(letterButton);
         }
     }
 }
コード例 #5
0
 //Check if slot is in this rack
 private bool ContainsSlot(LetterSlot slotToFind)
 {
     foreach (LetterSlot slot in slots)
     {
         if (slot == slotToFind)
         {
             return(true);
         }
     }
     return(false);
 }
コード例 #6
0
    public void OnClick()
    {
        LetterSlot letterSlot = transform.parent.GetComponent <LetterSlot>();

        if (letterSlot != null)
        {
            Debug.Log("Letter Slot => " + letterSlot.name);
            LetterRack letterRack = letterSlot.LetterRack;
            if (letterRack != null)
            {
                Debug.Log("Letter Rack => " + letterRack.name);
                letterRack.LetterButtonTapped(this);
            }
        }
    }
コード例 #7
0
 //Returns null if there is no tile in the slot
 public LetterButton GetLetterButtonInSlot(LetterSlot slot)
 {
     return(slot.LetterButton);
 }