public void SwitchToAM() { alarmToSet.noon = Noon.AM; if (pmText.IsActive()) { pmText.GetComponent <ColorChanger>().ChangeColorValueTo(ColorValue.MidLight); amText.GetComponent <ColorChanger>().ChangeColorValueTo(ColorValue.Dark); } }
public void OnClickParagrapheOrdi() { //Debug.Log("paragraph clicked running"); if (!validate) { image.gameObject.SetActive(!image.IsActive()); image.color = HighlightColor; //button.text = info.champLexical.fichierWords.name; collect.gameObject.SetActive(!collect.IsActive()); } }
public void UpdateTargetInformation(WorldObject obj) { // Hide when object is null. if (obj == null) { HideTargetInformation(); return; } // Show if hidden. if (!targetInformation.IsActive()) { targetInformation.gameObject.SetActive(true); targetHpBar.gameObject.SetActive(true); } // Update information. CharacterDataHolder data = obj.characterData; if (data != null) { targetInformation.text = data.GetName(); float progress = Mathf.Clamp01(data.GetCurrentHp() / data.GetMaxHp()); targetHpBar.value = progress; targetHpPercent.text = (int)(progress * 100f) + "%"; } }
private void LateUpdate() { if (ammoCountUI.IsActive()) { ammoCountUI.text = "" + weaponScript.ammo; } }
private void Update() { displayScoreText.text = gameSession.getCurrentScore().ToString(); if (displayHealthText.IsActive()) { healthUI(); } }
void OnUnPause(DefaultEvent eventdata) { Paused = false; if (Text.IsActive()) { typing = StartCoroutine(TypeText(Text.maxVisibleCharacters)); } }
/// <summary> /// Resets the GUI on the card. /// </summary> void ResetGui() { cardName.text = card.CardName; cardDescription.text = card.CardDescription; if (cardCost.IsActive()) { cardCost.text = card.PurchaseCostWords; } }
/// <summary> /// Check if logs have been read and pulls from subscriber /// </summary> public void Update() { // check if logs have been read if (operatorLogTextMesh.IsActive() == true) { operatorUnreadCount = 0; UpdateOperatorUnreadCounter(); } // Pull from subscriber if (LogSubscriber.Instance.MessageQueueCount() != 0) { AudioManager.Instance.PlayMessageSound(); RosSharp.RosBridgeClient.Message messageObject = LogSubscriber.Instance.DequeueOperatorMessage(); AddOperatorLogMessage(messageObject); } }
// scaling the size of this text IEnumerator ScaleTextCo() { transform.localScale = textStartingSize; while (tmpUGUI.IsActive()) { transform.localScale = Vector3.Lerp(transform.localScale, textSizeTarget, scaleUpSpeed * Time.deltaTime); yield return(null); } }
private void RegisterButtonAction() { VerifyUserInputs(); WarningMessage.gameObject.SetActive(!string.IsNullOrEmpty(WarningMessage.text)); if (!WarningMessage.IsActive()) { SendToServer(); RegisterButton.interactable = false; } }
public void ButtonFct() { if (text1.IsActive()) { SwitchPanel(); } else { GameManager.StartGame(); } }
public void ShowStageClear() { if (StageClearText.IsActive()) { StageClearText.gameObject.SetActive(false); } else { StageClearText.gameObject.SetActive(true); } }
IEnumerator ShowCrashScreen() { if (checkText.IsActive()) { checkText.gameObject.SetActive(false); } crashText.gameObject.SetActive(true); yield return(new WaitForSeconds(timeForLandResultScreen)); crashText.gameObject.SetActive(false); ship.OnResultsScreenExit(); }
public void ShowMessage(string message, Color?color = null, float timeToShow = 3) { sceneMessageTimer = 0; if (sceneMessageText.IsActive()) { sceneMessageText.text = message; sceneMessageText.color = color ?? Color.red; return; } StartCoroutine(ShowMessageCoroutine(message, timeToShow, color ?? Color.red)); }
public void OnNameChangeActionListener() { //Check if name of the Saved Sticker already exists in the file. if (stickerData.GetAllStickers().Exists(x => x.stickerName == saveName.text)) { //Sticker Name already exists; display error. nameExistsError.gameObject.SetActive(true); saveButton.interactable = false; } else if (nameExistsError.IsActive()) { nameExistsError.gameObject.SetActive(false); saveButton.interactable = true; } }
void Update() { bool magicBootsActive = Input.GetButton("Jump"); if (magicBootsActive) { //Player.AddForce(new Vector2(0, magicBootsForce)); } if (Donnees.DistancePartieActuelle > 0.1f) { if (playerSpeed < 5f) { playerSpeed *= 1.001f; Donnees.VitessePiece = playerSpeed; } else { playerSpeed = 5f; } } if (Donnees.PopUpStatistiques == false) { MovePlayer(); RunAudioSource.UnPause(); } else { RunAudioSource.Pause(); } ManageGroundSound(); UpdateGroundedStatus(); if (!playerAnimator.GetBool("isDead")) { AdjustMagicBoots(magicBootsActive); } if (gameOver.IsActive() && !playerAnimator.GetBool("isDead")) { gameOver.gameObject.SetActive(false); Resume.gameObject.SetActive(true); } }
public void ShowStageText(int stageNum) { if (stageNum == 4) { StageText.SetText("Final Stage"); } else { StageText.SetText("Stage " + stageNum.ToString()); } if (StageText.IsActive()) { StageText.gameObject.SetActive(false); } else { StageText.gameObject.SetActive(true); } }
public void StartRunaround(int correctAns) { QuestionManager.Instance.ToggleAnswersVisibility("ON"); ToggleButtons("OFF"); ToggleHUDvisibility("ON"); Coroutine game = StartCoroutine(PlayRunaround(correctAns)); if (!m_TimerText.IsActive()) { m_TimerText.gameObject.SetActive(true); } if (!m_Score.gameObject.activeInHierarchy) { m_Score.gameObject.SetActive(true); } StartCoroutine(this.GetComponent <GameTimer>().Countdown(duration)); StartCoroutine(CalculateScore(duration - 1)); }
private void FixedUpdate() { int time = (int)(missionTime - Time.realtimeSinceStartup); if (Time.realtimeSinceStartup - timeToRegenerateEnergy + pauseTime >= 1 && !isPauseGame) { timeToRegenerateEnergy = Time.realtimeSinceStartup; playerEnergy += ENERGY_REGENERATION; enemyEnergy += ENERGY_REGENERATION; if (playerEnergy >= MAX_ENERGY) { playerEnergy = MAX_ENERGY; } if (enemyEnergy >= MAX_ENERGY) { enemyEnergy = MAX_ENERGY; } // GameObject eh=GameObject.Find("MainCanvas/EnemyInfo/EnemyHealth"); enemyEnergyFill.sizeDelta = new Vector2((200 / MAX_ENERGY) * enemyEnergy, 90); playerEnergyFill.sizeDelta = new Vector2((200 / MAX_ENERGY) * playerEnergy, 90); //Debug.Log("playerEnergy:"+playerEnergy); } if (time < 0 && !isEndRound && !isPauseGame) { isEndRound = true; time = 0; activeGoalText("DRAW"); } if (time <= 15 && !isRushTime) { isRushTime = true; ENERGY_REGENERATION = 2f; // Time.timeScale = 3f; } if (time < 0) { time = 0; } missionTimeText.text = time + "s" + ((isRushTime)?"(Rush Time)":""); if (Time.realtimeSinceStartup - timeGoalTextTemp + pauseTime > 2 && timeGoalTextTemp > 0 && s_goalText.IsActive() && !isPauseGame) { isEndRound = false; s_goalText.gameObject.SetActive(false); ResetAllObject(); ROUND++; if (ROUND > MAX_ROUND) { //END GAME // GameObject endgamePopup = GameObject.Find("MainCanvas/EndgamePopup"); endGameMenu.SetActive(true); endgameText.text = (playerScore > enemyScore)?"YOU WIN":"YOU LOSE"; Button btnPennalty = GameObject.Find("MainCanvas/EndgamePopup/btnPeneltyMode").GetComponent <Button>(); if (playerScore == enemyScore) { endgameText.text = "DRAW"; btnPennalty.interactable = true; } else { btnPennalty.interactable = false; } EndGame(); } ResetLevel(); } pauseTime = 0; }
/// <summary> /// Make the correct answer visible by flashing the responding plane. /// </summary> /// <returns></returns> private IEnumerator DisplayResult() { float counter = 0.0f; //Display the winning or loosing state if (!m_Outcome.IsActive()) { if (m_playerAnswer != null && m_correctAnswer == AnswerPlanes.IndexOf(m_playerAnswer)) { m_playerWon = true; m_Outcome.text = "Richtig!"; AudioSourcesManager.Instance.PlaySound("Winning"); m_Outcome.GetComponent <TextMeshProUGUI>().color = m_colWinning; } else { m_playerWon = false; m_Outcome.text = "Falsch!"; AudioSourcesManager.Instance.PlaySound("Losing"); m_Outcome.GetComponent <TextMeshProUGUI>().color = m_colLoosing; } ToggleResultText("ON"); } foreach (RunaroundAnswer ans in AnswerPlanes) { if (m_correctAnswer == AnswerPlanes.IndexOf(ans)) { ans.transform.position = ans.transform.parent.position; ans.Floor.transform.localScale = new Vector3(4, ans.Floor.transform.localScale.y, ans.Floor.transform.localScale.z); } else { ans.gameObject.SetActive(false); } } //Fancy flashy animation, highlighting correct answer in green and if player is on the wrong spot, in red. while (counter < 2.0f) { int t = AnswerPlanes.IndexOf(m_playerAnswer); //if (!m_playerWon && m_playerAnswer != null) //{ // //Standing on the wrong plate // m_playerAnswer.Floor.GetComponent<Renderer>().material = mat_incorrect; //} AnswerPlanes[m_correctAnswer].Floor.GetComponent <Renderer>().material = mat_highlighted; yield return(new WaitForSeconds(0.1f)); //if (!m_playerWon && m_playerAnswer != null) //{ // m_playerAnswer.Floor.GetComponent<Renderer>().material = dic_mat_answers[t]; //} int n = AnswerPlanes.IndexOf(AnswerPlanes[m_correctAnswer]); AnswerPlanes[m_correctAnswer].Floor.GetComponent <Renderer>().material = dic_mat_floors[n]; yield return(new WaitForSeconds(0.1f)); counter += 0.2f; } ToggleButtons("ON"); }
/// <summary> /// Calculates the button size and layout /// </summary> public void RecalculateLayout() { //check if everything is set if (iconLayoutControl == null || iconLayoutControl == null || buttonlayoutControl == null) return; //check if fixed size if (!FixedWidth) { textLayoutControl.sizeDelta = new Vector2(TextContainer.preferredWidth, textLayoutControl.sizeDelta.y); iconLayoutControl.sizeDelta = new Vector2(IconContainer?.sprite == null ? 0.0f : 30f, 30f); buttonlayoutControl.sizeDelta = new Vector2(40 + iconLayoutControl.rect.width + textLayoutControl.rect.width, buttonlayoutControl.rect.height); TextContainer.enableAutoSizing = false; } else { //get total width - margins float width = -30 + buttonlayoutControl.rect.width; //set icon layout and subtract from remaining width iconLayoutControl.sizeDelta = new Vector2(IconContainer?.sprite == null ? 0 : iconLayoutControl.sizeDelta.y, iconLayoutControl.sizeDelta.y); width -= iconLayoutControl.rect.width; //set text width to remaining width textLayoutControl.sizeDelta = new Vector2(width, textLayoutControl.sizeDelta.y); TextContainer.enableAutoSizing = true; TextContainer.enableWordWrapping = true; } //check if icon or text only if (!IconContainer.IsActive()) { textLayoutControl.anchorMin = new Vector2(0.5f, 0.5f); textLayoutControl.anchorMax = new Vector2(0.5f, 0.5f); textLayoutControl.pivot = new Vector2(0.5f, 0.5f); textLayoutControl.anchoredPosition = new Vector2(0, 0); TextContainer.alignment = TextAlignmentOptions.Center; } else { textLayoutControl.anchorMin = new Vector2(1, 0.5f); textLayoutControl.anchorMax = new Vector2(1, 0.5f); textLayoutControl.pivot = new Vector2(1, 0.5f); textLayoutControl.anchoredPosition = new Vector2(-10, 0); TextContainer.alignment = TextAlignmentOptions.Right; } if (!TextContainer.IsActive()) { iconLayoutControl.anchorMin = new Vector2(0.5f, 0.5f); iconLayoutControl.anchorMax = new Vector2(0.5f, 0.5f); iconLayoutControl.pivot = new Vector2(0.5f, 0.5f); iconLayoutControl.anchoredPosition = new Vector2(0, 0); } else { iconLayoutControl.anchorMin = new Vector2(0, 0.5f); iconLayoutControl.anchorMax = new Vector2(0, 0.5f); iconLayoutControl.pivot = new Vector2(0, 0.5f); iconLayoutControl.anchoredPosition = new Vector2(0, 0); } }
/// <summary> /// Reduces the AI's health and plays hurt animations + applies root motion. /// </summary> public virtual void TakeDamage(float damageValue) { if (isInvulnerable) // If flagged as invulnerable due to taking damage recently... { return; // Return out of method, take no damage } attackDelay = Time.time + attackCooldown; // Add onto the attack delay as we have been hit currentHealth = Mathf.Lerp(currentHealth, currentHealth - damageValue, 1f); // Reduce health by damage value healthSlider.value = currentHealth; // Update slider to represent new health total if (damageText.IsActive()) // If already showing damage text... { damageTextValue += damageValue; // Add onto existing damage text displayed } else // If not showing damage text... { damageTextValue = damageValue; // Show initial damage } damageText.text = damageTextValue.ToString(); if (healthCoroutine != null) // If the AI health is already visible { StopCoroutine(healthCoroutine); // Stop coroutine, prevents bar from disappearing before intended healthCoroutine = StartCoroutine(RevealHealthBar(3)); // Recall coroutine, ensures bar disappears when intended } else { healthCoroutine = StartCoroutine(RevealHealthBar(3)); // Start health coroutine to display AI health } if (damageTextCoroutine != null) // Same as above but for damage text { StopCoroutine(damageTextCoroutine); damageTextCoroutine = StartCoroutine(RevealDamageText(3)); } else { damageTextCoroutine = StartCoroutine(RevealDamageText(3)); } if (!ignoreCombatCircle) { if (!currentAttackers.Contains(this)) // If the AI is not within the list of attackers... { currentAttackers[Random.Range(0, currentAttackers.Count - 1)].GetComponent <Enemy>().RemoveFromAttackersList(); // Remove a random AI from the list currentAttackers.Add(this); // Add self to the list movingToAttack = true; // Flag as moving to attack to no longer be bound to the combat circle positions } } int hurtAnimationToPlay = Random.Range(0, hurtAnimations.Length); // Return random animation from list charAnim.CrossFade(hurtAnimations[hurtAnimationToPlay].name, 0.1f); // Play animation charAnim.applyRootMotion = true; int clipToPlay = Random.Range(0, hurtAudioClips.Length); characterAudioSource.clip = hurtAudioClips[clipToPlay]; characterAudioSource.Play(); }
// Update is called once per frame void Update() { /* * if(Input.GetKeyDown(KeyCode.Alpha1)) * { * gameController.playerSkills[Header.Skills.SHIELD] = true; * } * if (Input.GetKeyDown(KeyCode.Alpha2)) * { * gameController.playerSkills[Header.Skills.HEAL] = true; * } * if (Input.GetKeyDown(KeyCode.Alpha3)) * { * gameController.playerSkills[Header.Skills.BLOCK] = true; * } * if (Input.GetKeyDown(KeyCode.Alpha4)) * { * gameController.playerSkills[Header.Skills.JUMP] = true; * } * * if (Input.GetKeyDown(KeyCode.Alpha5)) * { * Debug.Log((bool)gameController.playerSkills[Header.Skills.SHIELD]); * } * if (Input.GetKeyDown(KeyCode.Alpha6)) * { * Debug.Log((bool)gameController.playerSkills[Header.Skills.HEAL]); * } * if (Input.GetKeyDown(KeyCode.Alpha7)) * { * Debug.Log((bool)gameController.playerSkills[Header.Skills.BLOCK]); * } * if (Input.GetKeyDown(KeyCode.Alpha8)) * { * Debug.Log((bool)gameController.playerSkills[Header.Skills.JUMP]); * }*/ if (cur == 7 && gameController.skillsUsed <= 0 && win == false) { win = true; SceneManager.LoadSceneAsync("Win"); } if (cur == -1) { //Remove Dialogue Window and switch to hunting board dialogueWindow.SetActive(false); HB_canvas.SetActive(true); globals.ResetHB(); globals.ManageHB(); } else { if (nodes[cur].background != "") { if (nodes[cur].background == "HB") { dialogueWindow.SetActive(false); if (!globals.LocationHistory.ContainsKey(DialogueEnvironment.Environment.HuntingBoard)) { background.sprite = env.bgList[(int)DialogueEnvironment.Environment.HuntingBoard]; } lastKnownBG = "HB"; } else if (nodes[cur].background == "TV") { background.sprite = env.bgList[(int)DialogueEnvironment.Environment.Tavern]; if (!globals.LocationHistory.ContainsKey(DialogueEnvironment.Environment.Tavern)) { globals.LocationHistory.Add(DialogueEnvironment.Environment.Tavern, true); } lastKnownBG = "TV"; } else if (nodes[cur].background == "PH") { background.sprite = env.bgList[(int)DialogueEnvironment.Environment.PlayerHouse]; if (!globals.LocationHistory.ContainsKey(DialogueEnvironment.Environment.PlayerHouse)) { globals.LocationHistory.Add(DialogueEnvironment.Environment.PlayerHouse, true); } lastKnownBG = "PH"; } else if (nodes[cur].background == "CW") { background.sprite = env.bgList[(int)DialogueEnvironment.Environment.CastleWalls]; if (!globals.LocationHistory.ContainsKey(DialogueEnvironment.Environment.CastleWalls)) { globals.LocationHistory.Add(DialogueEnvironment.Environment.CastleWalls, true); } lastKnownBG = "CW"; } else if (nodes[cur].background == "TG") { background.sprite = env.bgList[(int)DialogueEnvironment.Environment.TrainingGrounds]; if (!globals.LocationHistory.ContainsKey(DialogueEnvironment.Environment.TrainingGrounds)) { globals.LocationHistory.Add(DialogueEnvironment.Environment.TrainingGrounds, true); } lastKnownBG = "TG"; } } if (Input.GetKeyDown(KeyCode.Return)) { //If all the text has been printed to screen, proceed with the next chunk of text if (print == false && dialogueBox.IsActive() == true) { //Speak the next chunk of main text textIndex++; if (textIndex < nodes[cur].mainText.Count && nodes[cur].mainText.Count != 0) { print = true; StartCoroutine(Speak(nodes[cur].mainText[textIndex])); } else if (nodes[cur].options.Count > 0 && !optionsDisplayed) { //Display Dialogue Choices //Selecting the choice will decide which node is gone to next //Do not update cur in this case, it will be handled by the option CreateDialogueChoices(); optionsDisplayed = true; } else if (optionsDisplayed && dialogueBox.IsActive() == false) { } else if (optionsDisplayed && dialogueBox.IsActive() == true) { optionsDisplayed = false; cur = next; textIndex = 0; print = true; if (cur > 0) { if (nodes[cur].mainText.Count == 0) { CreateDialogueChoices(); optionsDisplayed = true; } else { ChangeSpeaker(); StartCoroutine(Speak(nodes[cur].mainText[textIndex])); } } } else { //Move onto the next default node //cur will be updated to the default next node next = nodes[cur].nextID; if (next > 0) { cur = next; if (nodes[cur].mainText.Count == 0) { CreateDialogueChoices(); optionsDisplayed = true; } else { textIndex = 0; print = true; ChangeSpeaker(); StartCoroutine(Speak(nodes[cur].mainText[textIndex])); } } else { //Remove Dialogue Window and switch to hunting board dialogueWindow.SetActive(false); HB_canvas.SetActive(true); globals.ResetHB(); globals.ManageHB(); //background.sprite = env.bgList[(int)DialogueEnvironment.Environment.HuntingBoard]; } } } //If all the text has not been printed, jump to printing the rest else { print = false; } } } }
// Update is called once per frame void LateUpdate() { // Wood if (!WoodText.IsActive() && player.Wood > 0) { WoodText.gameObject.SetActive(true); } WoodText.text = ((int)player.Wood).ToString(); // Rock if (!RockText.IsActive() && player.Rock > 0) { RockText.gameObject.SetActive(true); } RockText.text = ((int)player.Rock).ToString(); // Food if (!FoodText.IsActive() && player.Food > 0) { FoodText.gameObject.SetActive(true); } FoodText.text = ((int)player.Food).ToString(); // Clay if (!ClayText.IsActive() && player.Clay > 0) { ClayText.gameObject.SetActive(true); } ClayText.text = ((int)player.Clay).ToString(); // Copper if (!CopperText.IsActive() && player.Copper > 0) { CopperText.gameObject.SetActive(true); } CopperText.text = ((int)player.Copper).ToString(); // Iron if (!IronText.IsActive() && player.Iron > 0) { IronText.gameObject.SetActive(true); } IronText.text = ((int)player.Iron).ToString(); // Happiness if (!HappinessText.IsActive() && player.Happiness > 0) { HappinessText.gameObject.SetActive(true); } HappinessText.text = ((int)player.Happiness).ToString(); // Coal if (!CoalText.IsActive() && player.Coal > 0) { CoalText.gameObject.SetActive(true); } CoalText.text = ((int)player.Coal).ToString(); // Oil if (!OilText.IsActive() && player.Oil > 0) { OilText.gameObject.SetActive(true); } OilText.text = ((int)player.Oil).ToString(); // Uranium if (!UraniumText.IsActive() && player.Uranium > 0) { UraniumText.gameObject.SetActive(true); } UraniumText.text = ((int)player.Uranium).ToString(); }