public Color GetNextLetterColor(bool _selecting, LetterBehaviour letter) { Color output; if (userWord.Count == 0) { output = Color.green; } else { output = Color.red; } if (!_selecting) { userWord.Add(letter); TryEndCondition(); } else { int index = userWord.IndexOf(letter); int wordLength = userWord.Count - 1; for (int i = wordLength; i >= index; i--) { userWord[i].Deselect(); userWord.Remove(userWord[i]); } } return(output); }
public Connection() { connectionRenderer = null; A = null; B = null; Initialized = false; }
public Connection(LetterBehaviour _A, LetterBehaviour _B, LineRenderer _renderer) { connectionRenderer = _renderer; connectionRenderer.SetPosition(0, _A.GetCustomPosition()); connectionRenderer.SetPosition(1, _B.GetCustomPosition()); A = _A; B = _B; Initialized = true; }
public bool IsConnected(LetterBehaviour nextLetter) { if (userWord.Count == 0) { return(true); } if (connections.HasConnection(userWord[userWord.Count - 1], nextLetter)) { return(true); } return(false); }
//Force algorithm : fix public bool HasConnection(LetterBehaviour A, LetterBehaviour B) { for (int i = 0; i < letterGraph.GetLength(0); i++) { for (int j = 0; j < letterGraph.GetLength(1); j++) { if (letterGraph[i, j].A == null) { continue; } if (letterGraph[i, j].A == A && letterGraph[i, j].B == B) { return(true); } if (letterGraph[i, j].A == B && letterGraph[i, j].B == A) { return(true); } } } return(false); }
private void AddLetterToArea(LetterBehaviour letter) { Vector3 pos = cameraArea.GetRandomPoint(letter); letter.gameObject.transform.position = pos; }