private void startButton_Click(object sender, EventArgs e) { var cdc = new CountdownController(); Thread t = new Thread(() => cdc.DoCountdown(10)) { Name = "Thread " + _threadCount++ }; _cThreads.Enqueue(t); threadList.AppendText(t.Name + "\r\n"); t.Start(); }
void Awake() { if (instance == null) { instance = this; } else { Destroy(gameObject); return; } }
void Start() { countdown = FindObjectOfType <CountdownController>(); GameObject countdownItem = GameObject.Find("CountdownText"); countdownText = countdownItem.GetComponent <Text>(); GameObject roundNumItem = GameObject.Find("RoundText"); roundText = roundNumItem.GetComponent <Text>(); roundText.text = string.Format( "ROUND {0}", FindObjectOfType <GameSessionController>().Round.ToString()); }
//temp void Start() { levels.Clear(); foreach (Transform t in transform) { LevelData l = t.GetComponent <LevelData>(); levels.Add(l); l.map.gameObject.SetActive(false); l.ionMap.gameObject.SetActive(false); l.specialsMap.gameObject.SetActive(false); } if (player == null) { player = GameObject.Find("Player").GetComponent <Player>(); } if (camera == null) { camera = GameObject.Find("Main Camera").GetComponent <CameraController>(); } if (music == null) { music = GameObject.Find("Music Source").GetComponent <AudioSource>(); } if (countdown == null) { countdown = GameObject.Find("Countdown").GetComponent <CountdownController>(); } if (scoreController == null) { scoreController = GameObject.Find("Score").GetComponent <ScoreController>(); } if (menu == null) { menu = GameObject.Find("MenuController").GetComponent <MenuController>(); } if (BG == null) { BG = camera.transform.GetChild(0).GetComponent <MeshRenderer>().material; } player.camera = camera; camera.player = player; EnterMenuMode(); menu.GoToMenu(menu.mainMenu, false); }
/// <summary> /// Initialize all the GameObjects and resources for the Timer superclass. /// </summary> protected void InitializeTimer() { gameData = GameObject.Find("Game Data").GetComponent <GameData>(); slider = GameObject.Find("Slider").GetComponent <Slider>(); sliderFill = GameObject.Find("Slider Fill").GetComponent <Image>(); gameplayController = GameObject.Find("Gameplay Controller").GetComponent <GameplayController>(); speechController = GameObject.Find("Speech Controller").GetComponent <SpeechController>(); startButtonController = GameObject.Find("Start Button Controller").GetComponent <StartButtonController>(); sceneTransitionController = GameObject.Find("Transition").GetComponent <SceneTransitionController>(); playerAnimationController = GameObject.Find("Player Animation Controller").GetComponent <PlayerAnimationController>(); countdownController = GameObject.Find("Countdown Controller").GetComponent <CountdownController>(); // Set the total time and bounded time timeMax = gameData.GetTimeTotal(); bound = gameData.GetBound() * timeMax; }
private IEnumerator OnTriggerEnter(Collider other) { if (!_gameStarted) { _collided = true; yield return(new WaitForSeconds(3)); if (_collided) { CountdownController countdown = GameObject.Find("CountdownCanvas").GetComponent <CountdownController>(); countdown.StartCountDown(); _gameStarted = true; this.gameObject.SetActive(false); //this.GetComponent<Renderer>().SetActive } } }
private void Awake() { instance = this; }
public void SetCountDownNow() { countdownController = GameObject.FindGameObjectWithTag("GameController").GetComponent <CountdownController> (); countdownController.counterDownDone = true; }