private void GameDetails() { GUI.Label(new Rect(startX + 205, startY + 170, 180, 21), "Score Limit"); scoreLimit = GUI.TextField(new Rect(startX + 205, startY + 190, 50, 21), scoreLimit, 25); if (int.TryParse(scoreLimit, out scoreMax)) { if (!(scoreMax < 1000)) { GUI.Label(new Rect(startX + 255, startY + 190, 180, 21), "<1000"); } if (!(scoreMax > 0)) { GUI.Label(new Rect(startX + 185, startY + 190, 180, 21), "0 < "); } } else { GUI.Label(new Rect(startX + 185, startY + 210, 180, 21), "Enter a number"); } int selectedDifficulty = difficulties.GetSelectedItemIndex(); GUI.Label(new Rect(startX + 205, startY + 300, 180, 21), "Difficulty"); selectedDifficulty = difficulties.List(new Rect(startX + 205, startY + 320, 60, 20), Difficulties[selectedDifficulty].text, Difficulties, listStyle); gameDifficulty = (BotDifficulty.Difficulty)System.Enum.Parse(typeof(BotDifficulty.Difficulty), Difficulties[selectedDifficulty].text); }
private void Start () { GameData info = GameObject.Find("GameData").GetComponent<GameData>(); botRocketCaliber = info.botRocketCaliber; playerRocketCaliber = info.playerRocketCaliber; playerShellCaliber = info.playerShellCaliber; botShellCaliber = info.botShellCaliber; playerRocketCount = info.playerRocketCount; botRocketCount = info.botRocketCount; ShowBotChassisProps = info.ShowBotChassisProps; ShowBotTurretProps = info.ShowBotTurretProps; ShowBotMinigun = info.ShowBotMinigun; ShowBotSideskirts = info.ShowBotSideskirts; ShowPlayerChassisProps = info.ShowPlayerChassisProps; ShowPlayerTurretProps = info.ShowPlayerTurretProps; ShowPlayerMinigun = info.ShowPlayerMinigun; ShowPlayerSideskirts = info.ShowPlayerSideskirts; scoreLimit = info.scoreMax; difficultyLevel = info.gameDifficulty; Destroy(GameObject.Find("GameData")); CreateNew(); for (int i = 1; i <= scoreLimit; i *= 10) { scoreLimitZeros++; } //Replaced at scene --> GameInformation //PauseMenu pauseMenu = gameObject.AddComponent("PauseMenu") as PauseMenu; }
private void Start() { GameData info = GameObject.Find("GameData").GetComponent <GameData>(); botRocketCaliber = info.botRocketCaliber; playerRocketCaliber = info.playerRocketCaliber; playerShellCaliber = info.playerShellCaliber; botShellCaliber = info.botShellCaliber; playerRocketCount = info.playerRocketCount; botRocketCount = info.botRocketCount; ShowBotChassisProps = info.ShowBotChassisProps; ShowBotTurretProps = info.ShowBotTurretProps; ShowBotMinigun = info.ShowBotMinigun; ShowBotSideskirts = info.ShowBotSideskirts; ShowPlayerChassisProps = info.ShowPlayerChassisProps; ShowPlayerTurretProps = info.ShowPlayerTurretProps; ShowPlayerMinigun = info.ShowPlayerMinigun; ShowPlayerSideskirts = info.ShowPlayerSideskirts; scoreLimit = info.scoreMax; difficultyLevel = info.gameDifficulty; Destroy(GameObject.Find("GameData")); CreateNew(); for (int i = 1; i <= scoreLimit; i *= 10) { scoreLimitZeros++; } //Replaced at scene --> GameInformation //PauseMenu pauseMenu = gameObject.AddComponent("PauseMenu") as PauseMenu; }
private void SetDestination() { if (gameObject.renderer.enabled && (int)timer % 2 == 0) { waypoints[1] = targetBotPoint.transform; BotDifficulty.Difficulty difficultyLevel = GameObject.Find("GameInformation").GetComponent <GameInformation>().difficultyLevel; BotDifficulty difficultySettings = gameObject.AddComponent("BotDifficulty") as BotDifficulty; difficultySettings.botDifficulty = difficultyLevel; Vector3 target = GameObject.FindGameObjectWithTag("Player").transform.position; target.x += Random.Range(-15 * difficultySettings.ReactionTime, 15 * difficultySettings.ReactionTime); target.y += Random.Range(-15 * difficultySettings.ReactionTime, 15 * difficultySettings.ReactionTime); target.z += Random.Range(-15 * difficultySettings.ReactionTime, 15 * difficultySettings.ReactionTime); targetBotPoint.transform.position = target; } }
private void GameDetails() { GUI.Label( new Rect(startX + 205, startY + 170, 180, 21), "Score Limit"); scoreLimit = GUI.TextField(new Rect(startX + 205, startY + 190, 50, 21), scoreLimit, 25); if(int.TryParse(scoreLimit, out scoreMax)) { if (!(scoreMax < 1000)) { GUI.Label( new Rect(startX + 255, startY + 190, 180, 21), "<1000"); } if(!(scoreMax > 0)) { GUI.Label( new Rect(startX + 185, startY + 190, 180, 21), "0 < "); } } else { GUI.Label( new Rect(startX + 185, startY + 210, 180, 21), "Enter a number"); } int selectedDifficulty = difficulties.GetSelectedItemIndex(); GUI.Label( new Rect(startX + 205, startY + 300, 180, 21), "Difficulty"); selectedDifficulty = difficulties.List( new Rect(startX + 205, startY + 320, 60, 20), Difficulties[selectedDifficulty].text, Difficulties, listStyle ); gameDifficulty = (BotDifficulty.Difficulty)System.Enum.Parse(typeof(BotDifficulty.Difficulty), Difficulties[selectedDifficulty].text); }