public void StartSimulation(Action <ITrail> simulationComplete, Transform parent, Vector3 solutionStartPosition) { transform.parent = parent; transform.localPosition = solutionStartPosition; solutionViewer.ClearTrail(); this.simulationComplete = simulationComplete; animate.SetValue(true); Time.timeScale = simulationSpeed; currSampleIndex = 0; }
public void NewLevel() { loadingScreen.enabled = true; levelPlayable.SetValue(false); levelGenerator.GenerateNewLevel(); levelGenerator.LoadGeneratedLevel(); var config = levelConfigurationReference.GetLevelConfiguration(); var solutionBall = Array.Find(world.GetComponentsInChildren <ItemAnimator>(), item => item.GetId() == config.solutionItemId); solutionTrailGenerator.transform.position = solutionBall.transform.position + config.solutionStartPositionOnItem; solutionTrailGenerator.StartSimulation(samples => { solutionTrail = samples; levelGenerator.LoadGeneratedLevel(); loadingScreen.enabled = false; levelPlayable.SetValue(true); }, solutionBall.transform, config.solutionStartPositionOnItem); }
private void StartTrail(RaycastHit hit) { currSpawner = Instantiate(prefab, hit.point, Quaternion.identity, hit.transform); animate.SetValue(true); wasAnimating = true; }