コード例 #1
0
    private void UpdateHUD()
    {
        if (_Rower == null)
        {
            return;
        }

        _MachineStatus.SetText(_Rower.RowerState.ToString());

        switch (_Rower.RowerState)
        {
        case MachineState.InUse:
        case MachineState.Paused:
            UpdateHUDWorkoutValues();
            break;

        case MachineState.Ready:
        case MachineState.Idle:
        case MachineState.OffLine:
        default:
            _WorkoutCadence.SetText(string.Empty);
            _WorkoutDistance.SetText(string.Empty);
            _WorkoutDuration.SetText(string.Empty);
            _WorkoutCalories.SetText(string.Empty);
            _WorkoutHeartRate.SetText(string.Empty);
            _WorkoutPower.SetText(string.Empty);
            break;
        }
    }
コード例 #2
0
 private void SetSpatialized()
 {
     m_IsSpatialized             = true;
     m_SourceObject.spatialBlend = 1;
     m_TextMeshPro.SetText("Set Stereo");
     m_SourceObject.outputAudioMixerGroup = RoomEffectGroup;
 }
コード例 #3
0
    void PlotLoss(int step, float loss)
    {
        if (iterationText)
        {
            iterationText.SetText($"iteration:{step}");
        }
        if (lossText)
        {
            lossText.SetText($"loss:{loss}");
        }

        lossBufferCPU[step] = loss;
        maxValueLoss        = Mathf.Max(maxValueLoss, loss);
        lossBufferGPU.SetData(lossBufferCPU, 0, 0, totalSteps);

        int kernelHandle = graphPlotter.FindKernel("CSMain");

        graphPlotter.SetTexture(kernelHandle, "graphTexture", graphRT);
        graphPlotter.SetBuffer(kernelHandle, "graphBuffer", lossBufferGPU);
        graphPlotter.SetInt("graphDimX", graphRT.width);
        graphPlotter.SetInt("graphDimY", graphRT.height);
        graphPlotter.SetInt("graphBufferTotalCount", totalSteps);
        graphPlotter.SetInt("graphBufferValueCount", step + 1);
        graphPlotter.SetFloat("maxValue", maxValueLoss);
        graphPlotter.SetFloats("backgroundColor", new float[] { Camera.main.backgroundColor.r, Camera.main.backgroundColor.g, Camera.main.backgroundColor.b, Camera.main.backgroundColor.a });
        graphPlotter.SetFloats("lossColor", new float[] { lossColor.r, lossColor.g, lossColor.b, lossColor.a });

        graphPlotter.Dispatch(kernelHandle, graphRT.width / 8, graphRT.height / 8, 1);
        graphMaterial.mainTexture = graphRT;
    }
コード例 #4
0
    void Update()
    {
        if (Application.loadedLevelName == "LevelEditor" || !mRenderer.enabled || isDone)
        {
            return;
        }

        float elapsedTime = (Time.realtimeSinceStartup - mTime);

        if (elapsedTime >= _SelfDestructDuration)
        {
            //gameObject.SetActive(false);
            mRenderer.enabled   = false;
            textMeshPro.enabled = false;
            mAudioSource.Play();
            mBombCount--;

            if (mBombCount == 0)
            {
                GameObject.Destroy(mTickingAudioSource.gameObject);
            }
        }
        else
        {
            float remaining = _SelfDestructDuration - elapsedTime;
            textMeshPro.SetText(remaining.ToString("0"));
        }
    }
コード例 #5
0
    private void RefreshTimeText()
    {
        int    timeStringIndex = System.Math.Min(System.Math.Max((int)(_timeFraction * (float)TimeStrings.Length), 0), TimeStrings.Length - 1);
        string timeString      = TimeStrings[timeStringIndex];

        _textMesh.SetText(timeString);
    }
コード例 #6
0
    public void AssignCustomerOrder(CustomerOrder InOrder, bool bShowResults)
    {
        _order = InOrder;

        StringBuilder PanelStringBuilder = new StringBuilder();

        PanelStringBuilder.AppendLine(string.Format("Order: {0}", _order.OrderNumber));

        for (int itemMarkIndex = 0; itemMarkIndex < ItemMarks.Length; ++itemMarkIndex)
        {
            ItemMarks[itemMarkIndex].SetActive(false);
        }
        _bMarksInitialized = true;

        for (int desireIndex = 0; desireIndex < _order.CustomerDesires.Length; ++desireIndex)
        {
            PanelStringBuilder.AppendLine(_order.CustomerDesires[desireIndex].ToUIString());

            if (bShowResults)
            {
                ItemMarks[desireIndex].SetActive(true);
                ItemMarks[desireIndex].GetComponent <MeshRenderer>().material = _order.CustomerDesires[desireIndex].DesireMet ? GreenCheckMaterial : RedXMaterial;
            }
        }

        _textMesh.SetText(PanelStringBuilder);
        _bIsShowingResults = bShowResults;
    }
コード例 #7
0
    /// <summary>
    /// Tries to damage the building if unlucky.
    /// </summary>
    private void CheckForDisaster()
    {
        //Creates a list of potential disasters
        List <BuildingDistaster> disasters = new List <BuildingDistaster>();

        disasters.AddRange(thisBuilding.potentialDisasters);
        disasters.AddRange(tile.properties.environmentalDisaster);

        foreach (BuildingDistaster disaster in disasters)
        {
            // If the building isn't already broken and the risk returns true a disaster occurs.
            if (durability > 0 && SoulTycoon.AttemptRisk(disaster.risk))
            {
                //Gameplay implications
                int damageDealt = (int)SoulTycoon.VariableValue(disaster.damageBase, disaster.damageVariance);
                durability = Mathf.Max(durability - damageDealt, 0);

                //Play particle effects
                SmokeParticles.Emit(15);
                if (durability <= 0)
                {
                    SmokeParticles.Play();
                }

                //Create a notifiaction about the disaster.
                GameObject        go       = Instantiate(Resources.Load <GameObject>("Disaster"), transform.position - new Vector3(0, 0, 1), Quaternion.identity);
                TMPro.TextMeshPro textMesh = go.GetComponent <TMPro.TextMeshPro>();
                textMesh.SetText(string.Format(durability > 0 ? "{0}!\nIntegrity {2}%" : "{0}\nRepairs needed!", disaster.name, damageDealt, Mathf.Max((float)durability / thisBuilding.durability * 100, 0).ToString("N1")));
                textMesh.color = new Color(1f, 0.7f, 0.7f);

                //Only one disaster can occur per hour so we stop running through the foreach loop here.
                break;
            }
        }
    }
コード例 #8
0
 public void StartGame()
 {
     timerrunning = true;
     shotTimer    = 0;
     //AddToTimer ();
     home.SetText("Home: 0");
     guest.SetText("Guest: 0");
 }
コード例 #9
0
    public void ShowMessage(string text, float duration = 2f)
    {
        GameManager.PopupMessageOpen();
        m_Open = true;
        m_Text.SetText(text);

        StartCoroutine(doShow(duration));
    }
コード例 #10
0
ファイル: TimerGUI.cs プロジェクト: Towkin/Adrift
    // Update is called once per frame
    void Update()
    {
        timer -= Time.deltaTime;
        string minutes = Mathf.Floor(timer / 60).ToString("00");
        string seconds = (timer % 60).ToString("00");
        string ms      = ((timer * 1000) % 1000).ToString("000");

        _textTarget.SetText("[" + minutes + ":" + seconds + "." + ms + " ]");
    }
コード例 #11
0
 public void UpdateText()
 {
     if (firstUnmarkedCharIndex == 0)
     {
         text.SetText($"<color=#{unmarkedColorHex}><u>{targetString[0]}</u>{targetString.Substring(1)}");
     }
     else if (firstUnmarkedCharIndex < targetString.Length)
     {
         text.SetText($"<color=#{markedColorHex}>{targetString.Substring(0, firstUnmarkedCharIndex)}" +   // Marked
                      $"<color=#{unmarkedColorHex}><u>{targetString[firstUnmarkedCharIndex]}</u>" +       // First unmarked char is underlined
                      $"{targetString.Substring(firstUnmarkedCharIndex + 1)}");                           // Remaining unmarked
     }
     else
     {
         text.SetText($"<color=#{markedColorHex}>{targetString}");
     }
     firstUnmarkedCharIndex++;
 }
コード例 #12
0
ファイル: DataVis.cs プロジェクト: RealityVirtually2019/boop
 // Update is called once per frame
 void Update()
 {
     // debug cube
     transform.position = localData.pos;
     // debug text
     if (Input.GetKeyDown(KeyCode.Space))
     {
         Instantiate(testCube);
     }
     testText.SetText("Debug: " + localData.pos);
 }
コード例 #13
0
    private void Update()
    {
        if (m_Time <= 0)
        {
            slowSfx.enabled     = false;
            stressedSfx.enabled = false;

            m_Time = 0;
            m_Value.SetText("0.0");

            m_Value.color           = m_Off;
            m_HourglassAnim.enabled = false;

            m_Vignette.SetColor(UIVignette.eColor.TimerOff);
        }
        else
        {
            m_Time -= Time.deltaTime;
            m_Value.SetText(m_Time.ToString("##.#"));

            if (m_Time > m_StressedValue)
            {
                slowSfx.enabled     = true;
                stressedSfx.enabled = false;


                m_Vignette.SetColor(UIVignette.eColor.TimerOn);

                m_Value.color = m_Good;
            }
            else
            {
                slowSfx.enabled     = false;
                stressedSfx.enabled = true;

                m_Vignette.SetColor(UIVignette.eColor.TimerStress);

                m_Value.color = m_Stressed;
            }
        }
    }
コード例 #14
0
    private IEnumerator TextBubbleRoutine(string line)
    {
        speechPivot.gameObject.SetActive(true);

        speechText.SetText(line);

        yield return(new WaitForSeconds(3));

        speechPivot.gameObject.SetActive(false);

        routine = null;
    }
コード例 #15
0
ファイル: AgentUI.cs プロジェクト: mapa17/breakfastclub
    // Start is called before the first frame update
    void Start()
    {
        navAgent       = gameObject.GetComponent <NavMeshAgent>();
        cam            = FindObjectOfType <Camera>();
        agent          = gameObject.GetComponent <Agent>();
        agentAnimator  = transform.Find("AgentAnimation").gameObject.GetComponent <Animator>();
        bubbleAnimator = transform.Find("BubbleAnimation").gameObject.GetComponent <Animator>();

        UICanvas      = FindObjectOfType <Canvas>();
        statsTooltip  = UICanvas.transform.Find("AgentStatsTooltip").GetComponent <AgentStatsTooltip>();
        AgentNameText = transform.Find("NameText").GetComponent <TMPro.TextMeshPro>();

        AgentNameText.SetText(agent.studentname);
    }
コード例 #16
0
    private IEnumerator StartupSequence()
    {
        float textDelay = 5f;

        yield return(ClickThroughText(textDelay,
                                      "I've spent too long being a stupid dumb guy"));

        yield return(ClickThroughText(textDelay,
                                      "It's time to show the world I can think deep thoughts"));

        yield return(ClickThroughText(textDelay,
                                      "I hope I can keep myself from getting too distracted"));

        text.SetText("");
        animator.SetBool("gameStarted", true);
        FindObjectOfType <EnemyManager>().gameStarted = true;
        target.gameStarted = true;
        FindObjectOfType <AudioManager>().Play("Typing");

        Vector3 startPosition = transform.position + 10f * Vector3.up;

        startPosition.z = 0f;
        Instantiate(player, startPosition, Quaternion.identity);
    }
コード例 #17
0
    private IEnumerator DrawSentence(string sentence)
    {
        string currentString = "";

        for (int i = 0; i < sentence.Length; i++)
        {
            // Update string
            currentString += sentence[i].ToString();

            // Write to TMP then wait
            text.SetText(currentString);
            yield return(new WaitForSeconds(letterTime));
        }

        yield return(SentenceComplete());
    }
コード例 #18
0
    private void ConnectToRower()
    {
        _Rower = GameObject.Find("RowerClient").GetComponent <RowerClient>();
        Debug.Log(_Rower.RowerState);

        _MachineStatus = GameObject.Find("HUD_MachineStatus").GetComponent <TextMeshPro>();
        _MachineStatus.SetText("Hello, World!");

        _MachineStatus    = GameObject.Find("HUD_MachineStatus").GetComponent <TextMeshPro>();
        _WorkoutCadence   = GameObject.Find("HUD_WorkoutCadence").GetComponent <TextMeshPro>();
        _WorkoutDistance  = GameObject.Find("HUD_WorkoutDistance").GetComponent <TextMeshPro>();
        _WorkoutDuration  = GameObject.Find("HUD_WorkoutDuration").GetComponent <TextMeshPro>();
        _WorkoutCalories  = GameObject.Find("HUD_WorkoutCalories").GetComponent <TextMeshPro>();
        _WorkoutHeartRate = GameObject.Find("HUD_WorkoutHeartRate").GetComponent <TextMeshPro>();
        _WorkoutPower     = GameObject.Find("HUD_WorkoutPower").GetComponent <TextMeshPro>();
    }
コード例 #19
0
    void checkState()
    {
        switch (state)
        {
        case States.onAim:
            setToTick();
            state = checkArrow();
            break;

        case States.offAim:
            setToCross();
            state = checkArrow();
            break;

        case States.onThrow:
            if (timeAfterClick > timeBeforeThrown)
            {
                arrow.GetComponent <Throw>().throwArrow();
                state          = States.Thrown;
                timeAfterClick = 0;
            }
            else
            {
                timeAfterClick += Time.deltaTime;
                timeText.SetText((timeBeforeThrown - timeAfterClick).ToString("0.#"));
                if (isMoved())
                {
                    Debug.Log("!!!!");
                    state          = checkArrow();
                    timeAfterClick = 0;
                }
            }
            setToTimer();
            break;

        case States.Thrown:
            setToTick();
            break;
        }
    }
コード例 #20
0
ファイル: Price.cs プロジェクト: hengtek/Hades3310
 void Start()
 {
     text.SetText(price.ToString());
 }
コード例 #21
0
ファイル: ModalDialog.cs プロジェクト: hengtek/Hades3310
 public void SetText(string value)
 {
     text.SetText(value);
 }
コード例 #22
0
 private void UpdateUI()
 {
     text.SetText(remainingHits.ToString());
     spriteRenderer.color = Color.Lerp(Color.white, Color.red, remainingHits / 10f);
 }
コード例 #23
0
ファイル: TMPDialogueUI.cs プロジェクト: brimism/LatinVR
    /// Show a line of dialogue, gradually
    public override IEnumerator RunLine(Yarn.Line line)
    {
        lineText.gameObject.SetActive(false);
        lineText.gameObject.SetActive(true);
        // Reset text
        customTagHandler.StopAllCoroutines();
        customTagHandler.clearClones();
        prevColors.Clear();
        lineText.SetText(customTagHandler.ParseForCustomTags(YarnRTFToTMP(line.text)));
        lineText.ForceMeshUpdate();
        customTagHandler.ApplyTagEffects();

        // Set up teletype by setting alpha to 0
        TMPro.TMP_Text     m_TextComponent = lineText.GetComponent <TMPro.TMP_Text>();
        TMPro.TMP_TextInfo textInfo        = m_TextComponent.textInfo;
        while (textInfo.characterCount == 0)
        {
            yield return(new WaitForSeconds(0.25f));
        }
        Color32[] newVertexColors;
        for (int currentCharacter = 0; currentCharacter < textInfo.characterCount; currentCharacter++)
        {
            int materialIndex = textInfo.characterInfo[currentCharacter].materialReferenceIndex;
            newVertexColors = textInfo.meshInfo[materialIndex].colors32;
            int vertexIndex = textInfo.characterInfo[currentCharacter].vertexIndex;
            // Save prev color
            if (textInfo.characterInfo[currentCharacter].isVisible)
            {
                for (int j = 0; j < 4; j++)
                {
                    prevColors.Add(textInfo.meshInfo[materialIndex].colors32[vertexIndex + j]);
                }
            }
            else
            {
                for (int j = 0; j < 4; j++)
                {
                    prevColors.Add(new Color32(0, 0, 0, 0));
                }
            }
            // Set color to transparent
            if (textInfo.characterInfo[currentCharacter].isVisible)
            {
                for (int j = 0; j < 4; j++)
                {
                    newVertexColors[vertexIndex + j] = new Color32(textInfo.meshInfo[materialIndex].colors32[vertexIndex + j].r, textInfo.meshInfo[materialIndex].colors32[vertexIndex + j].g, textInfo.meshInfo[materialIndex].colors32[vertexIndex + j].b, 0);
                }
                m_TextComponent.UpdateVertexData(TMPro.TMP_VertexDataUpdateFlags.Colors32);
            }
        }

        if (textSpeed > 0.0f)
        {
            // Display the line one character at a time
            for (int i = 0; i < textInfo.characterCount; i++)
            {
                int materialIndex = textInfo.characterInfo[i].materialReferenceIndex;
                newVertexColors = textInfo.meshInfo[materialIndex].colors32;
                int vertexIndex = textInfo.characterInfo[i].vertexIndex;
                if (textInfo.characterInfo[i].isVisible)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        newVertexColors[vertexIndex + j] = prevColors[4 * i + j];
                    }
                    m_TextComponent.UpdateVertexData(TMPro.TMP_VertexDataUpdateFlags.Colors32);
                }
                yield return(new WaitForSeconds(textSpeed));
            }
        }
        else
        {
            // Display the entire line immediately if textSpeed <= 0
            for (int currentCharacter = 0; currentCharacter < textInfo.characterCount; currentCharacter++)
            {
                int materialIndex = textInfo.characterInfo[currentCharacter].materialReferenceIndex;
                newVertexColors = textInfo.meshInfo[materialIndex].colors32;
                int vertexIndex = textInfo.characterInfo[currentCharacter].vertexIndex;
                // Set color back to the color it is supposed to be
                if (textInfo.characterInfo[currentCharacter].isVisible)
                {
                    for (int j = 0; j < 4; j++)
                    {
                        newVertexColors[vertexIndex + j] = prevColors[4 * currentCharacter + j];
                    }
                    m_TextComponent.UpdateVertexData(TMPro.TMP_VertexDataUpdateFlags.Colors32);
                }
            }
        }

        // Reset custom tag runner
        customTagHandler.ClearParsedTags();

        // Show the 'press any key' prompt when done, if we have one
        if (continuePrompt != null)
        {
            continuePrompt.SetActive(true);
        }

        // Wait for trigger press
        while (gameManager.LH_Trigger == false && gameManager.RH_Trigger == false)
        {
            yield return(null);
        }

        // Avoid skipping lines if textSpeed == 0
        yield return(new WaitForEndOfFrame());

        // Hide the text and prompt
        lineText.gameObject.SetActive(false);

        if (continuePrompt != null)
        {
            continuePrompt.SetActive(false);
        }
    }
コード例 #24
0
 void UpdateHealtBar()
 {
     text.SetText($"{Stats.CurrentHealth.ToString()}/{Stats.temporaryMaxHealth.ToString()}");
 }
コード例 #25
0
 private void Start()
 {
     healthText.SetText(GetHealth().ToString());
     canMove = true;
 }
コード例 #26
0
//	void AddToTimer() {
//		shotTimer += 1;
//		if (timerrunning) {
//			NS.Timer.setTimeout (AddToTimer, 1000);
//		}
//
//	}
    public void Start()
    {
        highscore.SetText("Highscore: " + currenthighscore);
    }
コード例 #27
0
ファイル: Money.cs プロジェクト: hengtek/Hades3310
 void UpdateMoney()
 {
     text.SetText(Stats.Money.ToString());
 }
コード例 #28
0
ファイル: UIGold.cs プロジェクト: Kwakwaouaite/DungeonAdvisor
 // Start is called before the first frame update
 void Start()
 {
     m_Value = GameManager.GetGold();
     m_txtValue.SetText(m_Value.ToString("### ### ###"));
 }