// Update is called once per frame void Update() { float currentTime = Time.time; if (rotationEnabled && !pause && (currentTime > (startTimer + moveWindow))) { angle += (Time.deltaTime * (2 * Math.PI / secsPerRotation)); angle %= (2 * Math.PI); } // Update the scoreboard to rotate to face the user scoreboard.transform.rotation = Quaternion.LookRotation(scoreboard.GetComponent <Renderer>().bounds.center - cam.transform.position); // If still in preview mode update the target word every ten frames. if (preview && (counter % 10 == 0)) { SelectNextTarget(); // Word has been updated from console // Update the target and hard reset positons } else if (!preview && word != Target.GetWord()) { WordEmbedding we = GetWordEmbedding(word); if (we != null) { SetTarget(we); ResetPosition(); } // Number of Neighbours has been updated from console // Destory all current option game objects and rebuild } else if (!preview && k != number_of_neighbours) { for (int i = 0; i < k + 1; i++) { GameObject option = options[i]; UnityEngine.Object.Destroy(option); } k = number_of_neighbours; SetTarget(Target); //adjustZoomFromNeighbours(); // Create game options options = new GameObject[k + 1]; CreateGameObjects(); // Hard Reset ResetPosition(); } counter++; if (rotationEnabled && !pause && (currentTime > (startTimer + moveWindow))) { refreshPosition(); } }
// Update the focused target word for the model public void SetTarget(WordEmbedding we) { OldTarget = Target; Target = we; word = Target.GetWord(); Target.FindNN(embeddings, k); text.text = Target.GetWord(); }
public void SetWordEmbedding(WordEmbedding e) { we = e; text.text = we.GetWord(); }
public string getWord() { return(we.GetWord()); }
// Select the next sample target word private void SelectNextTarget() { Target = embeddings[(counter / 10) % count]; Target.FindNN(embeddings, k); text.text = Target.GetWord(); }