public void SetDifficulty(BotLogic.botDifficulty _difficulty) { difficulty = _difficulty; switch (difficulty) { case BotLogic.botDifficulty.easy: botFov = 30; minBombTime = 5; maxBombTime = 20; minGunTime = 0.5f; maxGunTime = 4; reactionTime = 2f; fleeChance = 1.0f / 6; break; case BotLogic.botDifficulty.medium: botFov = 45; minBombTime = 3; maxBombTime = 10; minGunTime = 0; maxGunTime = 2; reactionTime = 0.3f; fleeChance = 1.0f / 10; break; case BotLogic.botDifficulty.hard: botFov = 90; minBombTime = 3; maxBombTime = 5; minGunTime = 0; maxGunTime = 1; reactionTime = 0.25f; fleeChance = 1.0f / 20; break; case BotLogic.botDifficulty.max: botFov = 90; minBombTime = 1; maxBombTime = 5; minGunTime = 0; maxGunTime = 0; reactionTime = 0; fleeChance = 0; break; default: break; } }
void Update() { //menu music if (!transform.GetChild(0).gameObject.GetComponent <AudioSource>().isPlaying&& !gameLaunched && volume > 0) { transform.GetChild(0).gameObject.GetComponent <AudioSource>().Play(); } else if (!transform.GetChild(0).gameObject.GetComponent <AudioSource>().isPlaying&& volume > 0) { transform.GetChild(0).gameObject.GetComponent <AudioSource>().Play(); } else if (gameLaunched && volume > 0) { volume -= Time.deltaTime * fallOff; if (volume < 0) { volume = 0; } transform.GetChild(0).gameObject.GetComponent <AudioSource>().volume = volume; } //controllerManager.Update(); if (controllerManager == null) { controllerManager = GameObject.FindGameObjectsWithTag("PlayerManager")[0].GetComponent <PlayerManagerScript>().controllerManager; } if (selectingPlayers) { int playersReady = 0; for (int i = 0; i < playerSelectors.Count; i++) { if (playerSelectors[i].GetComponent <ClassSelectorScript>().launched) { playersReady++; } } gameLaunchTime -= Time.deltaTime; if (gameLaunchTime < 0) { LaunchMatch(); } if (controllerManager.dirty) { numPlayers = controllerManager.GetPlayers(ref players); //Debug.Log(controllerManager.playersReady); controllerManager.dirty = false; if (controllerManager.playersEnabled == playersReady && numPlayers > 0) { LaunchMatch(); } else if (numPlayers == 0) { transform.GetChild(0).GetChild(0).gameObject.SetActive(true); foreach (GameObject selector in playerSelectors) { selector.SendMessage("ResetPointer"); selector.GetComponent <ClassSelectorScript>().canWrite = false; } selectingPlayers = false; } UpdateSelectors(); } } else if (!gameLaunched) { MenuUpdate(); if (controllerManager.dirty) { numPlayers = controllerManager.GetPlayers(ref players); controllerManager.dirty = false; } for (int i = 0; i < players.Count; i++) { if (players[i].controller.isConfirmDown && pointerIndex == 1) { BeginPlayerSelect(i); transform.GetChild(0).GetChild(0).gameObject.SetActive(false);//disables main menu numPlayers = 1; break; } } botDiff = (BotLogic.botDifficulty)botDiffIndex; mapType = (MapType)mapTypeIndex; arenaHeight = 0; arenaDepth = 0; switch (mapType) { case MapType.cross: switch (mapSizeIndex) { case 0: arenaWidth = 20; thickness = 4; break; case 1: arenaWidth = 40; thickness = 6; break; case 2: arenaWidth = 60; thickness = 8; break; case 3: arenaWidth = 100; thickness = 10; break; default: break; } break; case MapType.tangle: switch (mapSizeIndex) { case 0: arenaWidth = 20; thickness = 4; break; case 1: arenaWidth = 40; thickness = 6; break; case 2: arenaWidth = 60; thickness = 8; break; case 3: arenaWidth = 100; thickness = 10; break; default: break; } break; case MapType.warren: switch (mapSizeIndex) { case 0: arenaWidth = 20; thickness = 4; break; case 1: arenaWidth = 40; thickness = 6; break; case 2: arenaWidth = 60; thickness = 8; break; case 3: arenaWidth = 100; thickness = 10; break; default: break; } break; case MapType.pillars: switch (mapSizeIndex) { case 0: arenaWidth = 20; thickness = 4; break; case 1: arenaWidth = 40; thickness = 6; break; case 2: arenaWidth = 60; thickness = 8; break; case 3: arenaWidth = 100; thickness = 10; break; default: break; } break; case MapType.cube: switch (mapSizeIndex) { case 0: arenaWidth = 20; break; case 1: arenaWidth = 40; break; case 2: arenaWidth = 60; break; case 3: arenaWidth = 100; break; default: break; } break; case MapType.sphere: switch (mapSizeIndex) { case 0: arenaWidth = 20; break; case 1: arenaWidth = 40; break; case 2: arenaWidth = 60; break; case 3: arenaWidth = 100; break; default: break; } break; case MapType.race: break; default: break; } } else { if (showPauseMenu) { if (controllerManager.uiController.isDownDown) { MovePausePointer(1); } if (controllerManager.uiController.isUpDown) { MovePausePointer(-1); } if (pauseIndex == 1 && controllerManager.uiController.isConfirmDown) { SetPauseMenu(false); controllerManager.isPaused = false; } if (pauseIndex == 2 && controllerManager.uiController.isConfirmDown) { GameObject.FindGameObjectsWithTag("PlayerManager")[0].GetComponent <PlayerManagerScript>().selectingPlayers = true; SceneManager.LoadScene(SceneManager.GetActiveScene().name); } if (pauseIndex == 3 && controllerManager.uiController.isConfirmDown) { Application.Quit(); } } } //if (Input.GetKeyDown(KeyCode.Tab)) { Application.Quit(); } //if (Input.GetKeyDown(KeyCode.T)) { SceneManager.LoadScene(SceneManager.GetActiveScene().name); } }