private IEnumerator PerformLevelInit() { GameObject levelStartController = GameObject.FindGameObjectWithTag("LevelStartController"); if (levelStartController != null) { StartSequence startSequence = levelStartController.GetComponent <StartSequence> (); AmazeballCam camController = GameObject.FindGameObjectWithTag("CameraRig").GetComponent <AmazeballCam> (); GameObject ball = GameObject.FindGameObjectWithTag("Player"); //disable player and controls camController.enabled = false; ball.GetComponent <Renderer> ().enabled = false; ball.GetComponent <Rigidbody> ().isKinematic = true; startSequence.init(); while (!startSequence.IsCompleted()) { yield return(new WaitForEndOfFrame()); } //enable player and controls camController.enabled = true; ball.GetComponent <Renderer> ().enabled = true; ball.GetComponent <Rigidbody> ().isKinematic = false; } SetupLevel(); }
private void Awake() { if (instance == null) { instance = this; } }
private void Awake() { // initialize singleton instance if (instance == null) { instance = this; } else { Destroy(gameObject); } }
public List <T> ParseContent(string[] content) { var result = new List <T>(); int[] currentPeriods = Array.Empty <int>(); var periods = new Dictionary <int, V>(); var firstItemFound = false; foreach (var line in content) { var startSequenceData = StartSequence.TryParse(line); var nonStartSequenceData = NonStartSequence.TryParse(line); if (startSequenceData.WasSuccessful && firstItemFound == false) { firstItemFound = true; continue; } if (startSequenceData.WasSuccessful || nonStartSequenceData.WasSuccessful) { if (periods.Count > 0) { // Builder! result.Add(BuildItem(periods)); periods.Clear(); currentPeriods = Array.Empty <int>(); } if (startSequenceData.WasSuccessful) { continue; } else if (firstItemFound) // only break if we found the first item section { break; } } var periodSection = PeriodSection.TryParse(line); if (periodSection.WasSuccessful) { currentPeriods = periodSection.Value.ToArray(); continue; } ParseLine(line, currentPeriods, periods); } return(result); }
/// <summary> /// Takes working directory and renames all files in this directory to specified sequence determined by NewFileName, NewFileNameEnd, StartSequence /// </summary> /// <param name="sDir"></param> private void RenameSequence(string sDir) { try { DirectoryInfo dir = new DirectoryInfo(sDir); FileInfo[] infos = dir.GetFiles(); // 0000, 1 w> 1, 0000, 13 w> 2 string seqWidth = ""; for (int i = 0; i < SequenceWidth; i++) { seqWidth += "0"; } foreach (FileInfo f in infos) { string tempName = f.Name; int indexLast = tempName.LastIndexOf('.'); string extension = tempName.Substring(indexLast); // Sets file extension to whatever is after '.' eg: .png .txt /* int currentSeqWidth = StartSequence.ToString().Length; // 4 = 1, 12 = 2, 465 = 3 * * for (int i = 0; i < SequenceWidth - currentSeqWidth; i++) * { * seqWidth += '0'; * }*/ File.Move(f.FullName, sDir + "\\" + NewFileName + StartSequence.ToString(seqWidth) + NewFileNameEnd + extension); Debug.WriteLine("File: " + f.Name + " renamed to: " + NewFileName + StartSequence.ToString(seqWidth) + NewFileNameEnd + extension); StartSequence++; } } catch (System.Exception e) { Console.WriteLine(e.Message); } }