public void SetUp() { gameObject = new GameObject(); key = gameObject.AddComponent <Key>(); gameObject.AddComponent <BoxCollider2D>(); key.Start(); keyRecorder = gameObject.AddComponent <KeyRecorder>(); keyRecorder.Start(); }
// Start is called before the first frame update void Start() { key.Start(GetComponent <MeshRenderer>()); }
public static void Main(string[] args) { InitializeConsole(); Command(out command); do { Title("Key Settings"); InputVal("\n\t\tEnter the Minimum value:", 0, 8, out min); InputVal("\n\t\tEnter the Maximum value", 1, 9, out max); proceed = false; do { Text(textC, "\n\t\tEnter the size of the Key"); Command(out command); if (Int32.TryParse(command, out size)) { if (size > 0) { proceed = true; } else { Text(errorC, "\n\t\tKey size must be bigger than \"0\""); } } else { Text(errorC, "\n\t\tYour input must be an integer."); } } while (!proceed); gen = new(size, min, max); nextSeed = true; do { Title("Number Settings"); Text(textC, "\n\t\tYour Key is: "); Text(variableC, gen.key); Write("\n\n"); int seed = 0; proceed = false; do { Text(ConsoleColor.DarkCyan, "\n\t\tEnter the seed: "); Command(out command); if (!proceed) { if (Int32.TryParse(command, out seed)) { proceed = true; } else { Text(errorC, "\n\t\tYour input must be an integer."); } } } while (!proceed); if (nextSeed) { int length = 1; proceed = false; do { Text(textC, "\n\t\tHow many digits you need: "); Command(out command); if (!proceed) { if (Int32.TryParse(command, out length)) { if (length > 0) { if (length >= size) { Text(errorC, "\n\t\tLength can't be equal or higher than the key."); } else { proceed = true; } } else { Text(errorC, "\n\t\tLength can't be \"0\""); } } else { Text(errorC, "\n\t\tYour input must be an integer."); } } } while (!proceed); if (nextSeed) { Text(textC, "\n\n\t\tYour seed is "); Text(variableC, seed.ToString()); Text(textC, " we will generate "); Text(variableC, length.ToString()); Text(textC, " digit long numbers proceduraly."); Text(textC, "\n\n\t\tType \""); Text(variableC, "next seed"); Text(textC, "\" to try other seed, \""); Text(variableC, "next key"); Text(textC, "\" to get other key or press \""); Text(variableC, "Enter"); Text(textC, "\" for next Iteration. \n\n"); gen.Start(seed, length); int iteration = 0; nextIteration = true; do { Text(textC, "\t\t\tSeed:"); Text(variableC, seed.ToString()); Text(textC, "\tIteration:"); Text(variableC, (++iteration).ToString()); Text(textC, "\tYour number:"); Text(variableC, gen.Next()); Command(out command); } while (nextIteration); } } } while (nextSeed); } while (nextKey); Text(infoC, "\tPress Enter to quit"); Command(out command); }