/////////////////////////// // Deprecated public void StartGrazScene() { // load a new scene SceneManager.LoadScene(1); asdf = m_TextComponent.GetComponent <TMP_Text>().text; Debug.Log(asdf); }
private void Start() { gameController = FindObjectOfType <GameController>(); interactionText.GetComponent <TextMeshProUGUI>().enabled = false; roundHasNotStarted = false; inRange = false; }
public void Search() { //gets inputted name string searcher = SearchPlayerInputField.GetComponent <TMP_InputField>().text.ToLower(); int index; //finds the searcher's index index = list.FindIndex(x => x.ToLower().Equals(searcher)); //if name doesn't exist if (index == -1) { TargetTxt.GetComponent <TMP_Text>().text = "Searched name doesn't exist, try again."; } else { //gives the player below them on the list as their target int targetIndex = index + 1; //checks if searcher is at the bottom of the list, if so make the target the player at the top of the list if (targetIndex == list.Count) { targetIndex = 0; } //shows target and clears name from search bar TargetTxt.GetComponent <TMP_Text>().text = "Target Player: " + list[targetIndex]; SearchPlayerInputField.GetComponent <TMP_InputField>().text = ""; } }
public void ArriveIntoGame() { title.GetComponent <Animator>().SetTrigger("TitleArrive"); startTapButton.GetComponent <Animator>().SetTrigger("TapButtonArrive"); startBestScore.text = "Best Score : " + GameManager.instance.GetBestScore(); startBestScore.GetComponent <Animator>().SetTrigger("StartBestArrive"); }
private void OnTriggerEnter(Collider other) { inRange = true; interactText.GetComponent <TextMeshProUGUI>().enabled = inRange && !hasAlreadyInteracted; dialogueTextBox.GetComponent <TextMeshProUGUI>().enabled = true; npcShout.GetComponent <TextMeshProUGUI>().enabled = false; }
// Start is called before the first frame update void Start() { SpawnPresents(roundCount); RoundManager(); presentReturnText.GetComponent <TextMeshProUGUI>().enabled = false; }
// Update is called once per frame void Update() { if (GameManager.gameScene == 19) { if (phase == 0) { one.gameObject.SetActive(true); } if (Input.GetKeyDown(KeyCode.Space) && phase == 0 && one.GetComponent <ScrollText>().isTyping) { one.GetComponent <ScrollText>().cancelTyping = true; } if (Input.GetKeyDown(KeyCode.Space) && phase == 0 && !one.GetComponent <ScrollText>().isTyping) { GameManager.gameScene = 22; SceneManager.LoadScene("Scene12"); } } if (GameManager.gameScene == 20) { if (phase == 0) { two.gameObject.SetActive(true); } if (phase == 1) { three.gameObject.SetActive(true); } if (Input.GetKeyDown(KeyCode.Space) && phase == 0 && two.GetComponent <ScrollText>().isTyping) { two.GetComponent <ScrollText>().cancelTyping = true; } if (phase == 1 && Input.GetKeyDown(KeyCode.Space)) { GameManager.gameScene = 22; SceneManager.LoadScene("Scene12"); } if (Input.GetKeyDown(KeyCode.Space) && phase == 0 && !two.GetComponent <ScrollText>().isTyping) { phase = 1; } } if (GameManager.gameScene == 21) { if (phase == 0) { four.gameObject.SetActive(true); } if (Input.GetKeyDown(KeyCode.Space) && phase == 0 && four.GetComponent <ScrollText>().isTyping) { four.GetComponent <ScrollText>().cancelTyping = true; } if (Input.GetKeyDown(KeyCode.Space) && phase == 0 && !four.GetComponent <ScrollText>().isTyping) { GameManager.gameScene = 22; SceneManager.LoadScene("Scene12"); } } }
public void StartTheGame() { //Enable the GUI scoreDisplayText.GetComponent<TextMeshProUGUI>().enabled = true; timeRemainingDisplayText.GetComponent<TextMeshProUGUI>().enabled = true; questionDisplay.SetActive(true); //Reset the score and its text playerScore = 0; scoreDisplayText.text = "Questions Correctly Answered: " + playerScore.ToString(); //Reset the question index so we start from the start again questionIndex = 0; allRoundData = dataController.GetCurrentRoundData(); questionPool = allRoundData.questions; ShowQuestion(); //reset the time remaining and start the counter. timeRemaining = allRoundData.timeLimitInSeconds; UpdateTimeRemainingDisplay(); isRoundActive = true; }
private IEnumerator TextJiggling(TMP_Text text) { while (true) { Vector2 pos = text.GetComponent <RectTransform>().anchoredPosition; text.GetComponent <RectTransform>().anchoredPosition = pos + UnityEngine.Random.insideUnitCircle * jiggleAmount; yield return(new WaitForFixedUpdate()); } }
private void Start() { playerMovement = FindObjectOfType <PlayerMovement>(); scoreDisplayText.GetComponent <TextMeshProUGUI>().enabled = false; timeRemainingDisplayText.GetComponent <TextMeshProUGUI>().enabled = false; dataController = FindObjectOfType <DataController>(); //timeRemaining = currentRoundData.timeLimitInSeconds; }
private IEnumerator JiggleText(TMP_Text text) { IEnumerator coroutine = TextJiggling(text); StartCoroutine(coroutine); yield return(new WaitForSeconds(jiggleTime)); StopCoroutine(coroutine); text.GetComponent <RectTransform>().anchoredPosition = text.GetComponent <StartPositionTracker>().GetPos(); }
void changeColor(bool state) { if (state) { lightParticle.GetComponent <Image>().color = new Color32(180, 255, 0, 255); } else { lightParticle.GetComponent <Image>().color = new Color32(255, 0, 10, 0); } }
public void TapButtonClick() { if (GameManager.instance.gameOver && GameManager.instance.freezeTiles) { scoreBoard.GetComponent <Animator>().SetTrigger("ScoreFadeIn"); startTapButton.GetComponent <Animator>().SetTrigger("TapButtonFade"); title.GetComponent <Animator>().SetTrigger("TitleFade"); startBestScore.GetComponent <Animator>().SetTrigger("StartBestFade"); StartCoroutine(FadeOutToGame()); } }
public void Open() { Time.timeScale = 1f; background.interactable = true; background.blocksRaycasts = true; background.DOFade(1, 0.25f); replayButton.GetComponent <RectTransform>().DOAnchorPosY(-500, 0.6f); exitButton.GetComponent <RectTransform>().DOAnchorPosY(-635, 0.4f); player1.GetComponent <RectTransform>().DOAnchorPosX(216, 0.5f); player2.GetComponent <RectTransform>().DOAnchorPosX(-216, 0.5f); victoryText.GetComponent <RectTransform>().DOAnchorPosY(-139, 0.5f); }
private void OnTriggerEnter(Collider other) { if (GetComponent <Renderer>().material.color == Color.white) { GetComponent <Renderer>().material.color = other.GetComponent <Renderer>().material.color; Debug.Log("Changed Color!"); } if (GetComponent <Renderer>().material.color == other.GetComponent <Renderer>().material.color) { Debug.Log("Nice! Get Points!"); Destroy(other.gameObject); } if (GetComponent <Renderer>().material.color != other.GetComponent <Renderer>().material.color) { Debug.Log("You Lose!"); StartCoroutine("YouDied"); } if (other.gameObject.tag == "Gem") { gameObject.GetComponent <AudioSource>().PlayOneShot(gemSound, .4f); itemScore = itemScore + 300; itemScoreUI.GetComponent <TextMeshProUGUI>().text = "+300"; itemScoreUI.gameObject.SetActive(true); StartCoroutine("WaitForSec"); } if (other.gameObject.tag == "Coin") { gameObject.GetComponent <AudioSource>().PlayOneShot(coinSound, 1f); itemScore = itemScore + 100; itemScoreUI.GetComponent <TextMeshProUGUI>().text = "+100"; itemScoreUI.gameObject.SetActive(true); StartCoroutine("WaitForSec"); } if (other.gameObject.tag == "Wall") { gameObject.GetComponent <AudioSource>().PlayOneShot(WallSound, 1f); itemScore = itemScore + 50; itemScoreUI.GetComponent <TextMeshProUGUI>().text = "+50"; itemScoreUI.gameObject.SetActive(true); StartCoroutine("WaitForSec"); } }
IEnumerator CountDownToStart() { if (finalScore != null) { finalScore.gameObject.SetActive(false); } getReady.gameObject.SetActive(true); getReady.GetComponent <Animator>().SetBool("GetReady", true); yield return(new WaitForSeconds(3)); getReady.GetComponent <Animator>().SetBool("GetReady", false); SceneChanger.ChangeLevel(1); }
void FormatTimer(float secondsRemaining) { string minutes = Mathf.Floor(secondsRemaining / 60).ToString("00"); string seconds = (secondsRemaining % 60).ToString("00"); //txtTimeRemaining.text = "Time Remaining: " + string.Format("{0}:{1}", minutes, seconds); txtTimeRemaining.text = string.Format("{0}:{1}", minutes, seconds); if (secondsRemaining < 10) { txtTimeRemaining.GetComponent <Animator>().SetBool("Hurry", true); } }
public void AnimAddBlocks(int amount) { blocks.text = (int.Parse(blocks.text) + amount).ToString(); blocksAnim.text = amount.ToString(); if (amount >= 0) { blocksAnim.GetComponent <Animation>().Play("AddResourceAnim"); } else { blocksAnim.GetComponent <Animation>().Play("MinResourceAnim"); } }
public void AnimAddCoins(int amount) { coins.text = (int.Parse(coins.text) + amount).ToString(); coinsAnim.text = amount.ToString(); if (amount >= 0) { coinsAnim.GetComponent <Animation>().Play("AddResourceAnim"); } else { coinsAnim.GetComponent <Animation>().Play("MinResourceAnim"); } }
public void AnimAddDiamonds(int amount) { diamonds.text = (int.Parse(diamonds.text) + amount).ToString(); diamondsAnim.text = amount.ToString(); if (amount >= 0) { diamondsAnim.GetComponent <Animation>().Play("AddResourceAnim"); } else { diamondsAnim.GetComponent <Animation>().Play("MinResourceAnim"); } }
// Update is called once per frame void Update() { if (weapScr.Primary == 0) { weapEq1.GetComponent <TMP_Text>().text = "Single Shot"; } if (weapScr.Primary == 1) { weapEq1.GetComponent <TMP_Text>().text = "Triple Shot"; } if (weapScr.Primary == 2) { weapEq1.GetComponent <TMP_Text>().text = "Pulse Wave"; } }
public void InsertMessage(int index) { if (index == 1) { MessageStorage.GetComponent <TMP_Text>().text = "В режиме редактора (по умолчанию) вы можете расставлять шары, задавать им необходимые физические величины. Также вы можете сохранять сцены и загружать ранее созданные.\nЕсли наверху написано [Editor Mode] - значит это режим редактора."; } else if (index == 2) { MessageStorage.GetComponent <TMP_Text>().text = "V - добавить шар\nP - сохранить сцену\nO - открыть сцену\nY - остановить физический процесс\nC - войти/выйти из режима редактора\nSPACE - начать следить за шаром / окончить слежение\nESC - выйти в главное меню"; } curindex = index - 1; }
public void SetMoneyCount() { int startMoney = (int)moneySlider.value; Settings.SET.startMoney = startMoney; moneyCountText.GetComponent <TMP_Text>().text = $"Start Money: {startMoney.ToString()} %"; }
public void StartDrawing(string wordToDisplay) { waitingPanel.SetActive(false); playerPanel.SetActive(true); drawingWordsDisplay.GetComponent <TMP_Text>().text += wordToDisplay; //start and sync timer }
public void SetAttackProbability() { int attackProbability = (int)probabilitySlider.value; Settings.SET.attackProbability = attackProbability; probabilityText.GetComponent <TMP_Text>().text = $"AI Attack Probability: {attackProbability.ToString()} %"; }
public void SetUnitsCount() { int maxUnits = (int)unitsSlider.value; Settings.SET.unitsCount = maxUnits; unitsCountText.GetComponent <TMP_Text>().text = $"Max Faction Units: {maxUnits.ToString()}"; }
public void OnHitBySkill(Player targetPlayer, Hashtable changedProps) { if (changedProps.ContainsKey(PunPlayerProps.PlayerCharacterHPProp)) { Debug.Log("Has HP"); object HP; if (targetPlayer.CustomProperties.TryGetValue(PunPlayerProps.PlayerCharacterHPProp, out HP)) { Health = (int)HP; Debug.Log(Health); HpText.GetComponent <TMP_Text>().text = Health.ToString(); if (Health <= 0) { object lives; if (view.Owner.CustomProperties.TryGetValue(PunPlayerProps.PlayerCharacterLivesProp, out lives)) { lives = (int)lives - 1; Hashtable props = new Hashtable { { PunPlayerProps.PlayerCharacterLivesProp, lives } }; PhotonNetwork.LocalPlayer.SetCustomProperties(props); } } } } }
void Start() { rt = this.GetComponent <RectTransform>(); maxWidth = rt.sizeDelta.x * 0.9f; minutesSecondsRT = minutesSeconds.GetComponent <RectTransform>(); //millisecondsRT = milliseconds.GetComponent<RectTransform>(); LevelName.text = this.gameObject.scene.name; showTimer = GameManager.Instance.SaveData.ShowTimer; if (showTimer) { SetTimer(0); minutesSeconds.ForceMeshUpdate(); // milliseconds.ForceMeshUpdate(); // SetMillisecondsEnabled(showMilliseconds); } else { minutesSeconds.gameObject.SetActive(false); milliseconds.gameObject.SetActive(false); // Position/Size Level Name //LevelName.fontSize = 200; //LevelName.alignment = TextAlignmentOptions.Center; //LevelName.GetComponent<RectTransform>().anchoredPosition = new Vector2(0, -9); } }
public void Awake() { if (Instance != null && Instance != this) { GameObject.Destroy(this); } else { Instance = this; } mainCamera = Camera.main.transform; currentMessageBoxSize = messageBox.GetComponent <RectTransform>().sizeDelta; UpdateChatSettingInputs(); }
public static TMP_Text Label( TMP_Text textObj, TMP_Text prototype, string name, string content, Transform parent, Vector2 pos, TextStyle style = null) { textObj = textObj ?? UnityEngine.Object.Instantiate(prototype); textObj.name = name; textObj.transform.SetParent(parent, false); var rt = textObj.GetComponent <RectTransform>(); rt.anchorMin = Vector2.zero; rt.anchorMax = Vector2.zero; rt.pivot = Vector2.zero; rt.sizeDelta = Vector2.zero; rt.anchoredPosition = pos; if (style != null) { textObj.color = style.color; textObj.fontSize = style.size; } textObj.text = content; return(textObj); }