Exemplo n.º 1
0
 public void OnLetterPressed(char pressedChar)
 {
     if (FallingWordsMain.SoundOn)
     {
         typing.Play();
     }
     if (selectedObject == null || selectedObject.ToDestroyFlag == true)
     {
         SelectWord(pressedChar);
         if (selectedObject != null && selectedObject.GetFirstNotDestroyed() != null)
         {
             WordManipulator.MakeFirstLowerToUpperChar(selectedObject.GetFirstNotDestroyed());
         }
     }
     else
     {
         if (WordManipulator.MatchFirstLowerChar(selectedObject.GetFirstNotDestroyed(), pressedChar))
         {
             WordManipulator.MakeFirstLowerToUpperChar(selectedObject.GetFirstNotDestroyed());
         }
         else
         {
             WordManipulator.UndoChanges(selectedObject.GetFirstNotDestroyed());
             selectedObject = null;
         }
     }
 }
Exemplo n.º 2
0
 private void SelectWord(char inputChar)
 {
     foreach (GameObject item in activeObjects)
     {
         Word firstNotDestroyed = item.GetFirstNotDestroyed();
         if (firstNotDestroyed != null && WordManipulator.MatchFirstLowerChar(firstNotDestroyed, inputChar))
         {
             selectedObject = item;
             break;
         }
     }
     //selectedObject = null;
 }