looping of text & audio, statistics/model info text added
This commit is contained in:
@@ -26,6 +26,9 @@ public class CameraManager : MonoBehaviour
|
||||
public LayerMask m_Environment;
|
||||
public LayerMask m_Actuations;
|
||||
|
||||
[Header("Text Objects")]
|
||||
public GameObject m_Rewards;
|
||||
|
||||
[Header("Camera Settings")]
|
||||
[Range(2, 20)]
|
||||
public int m_CameraBlendMin;
|
||||
@@ -107,15 +110,19 @@ public class CameraManager : MonoBehaviour
|
||||
{
|
||||
case "vc_Agent":
|
||||
m_Camera.cullingMask = m_Agent;
|
||||
m_Rewards.SetActive(true);
|
||||
break;
|
||||
case "vc_Body":
|
||||
m_Camera.cullingMask = m_Bodies;
|
||||
m_Rewards.SetActive(false);
|
||||
break;
|
||||
case "vc_Environment":
|
||||
m_Camera.cullingMask = m_Environment;
|
||||
m_Rewards.SetActive(false);
|
||||
break;
|
||||
case "vc_Actuations":
|
||||
m_Camera.cullingMask = m_Actuations;
|
||||
m_Rewards.SetActive(true);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
29
Assets/8_Scripts/1_Managers/Model Manager.cs
Normal file
29
Assets/8_Scripts/1_Managers/Model Manager.cs
Normal file
@@ -0,0 +1,29 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Unity.MLAgents.Policies;
|
||||
using UnityEngine;
|
||||
|
||||
public class ModelManager : MonoBehaviour
|
||||
{
|
||||
[SerializeField]
|
||||
public string m_ModelName;
|
||||
|
||||
private BehaviorParameters m_Parameters;
|
||||
|
||||
// Unity Events //
|
||||
public delegate void onUpdateModelNameDelegate(string modelName);
|
||||
public static onUpdateModelNameDelegate m_UpdateModelName;
|
||||
private void OnEnable()
|
||||
{
|
||||
m_Parameters = GetComponent<BehaviorParameters>();
|
||||
}
|
||||
|
||||
private void FixedUpdate()
|
||||
{
|
||||
if (m_Parameters != null)
|
||||
{
|
||||
m_ModelName = m_Parameters.Model.name;
|
||||
m_UpdateModelName?.Invoke(m_ModelName);
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/8_Scripts/1_Managers/Model Manager.cs.meta
generated
Normal file
11
Assets/8_Scripts/1_Managers/Model Manager.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: af36152b9449197449b578448c25b741
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -80,11 +80,11 @@ public class NarrationManager : MonoBehaviour
|
||||
// Increments to next index in list, and updates UI.
|
||||
void updateSubtitle()
|
||||
{
|
||||
m_ScriptIndex++;
|
||||
if (m_ScriptIndex == m_scriptSlices.Count)
|
||||
m_ScriptIndex = 0;
|
||||
CalculateVariableWaitTime(m_scriptSlices[m_ScriptIndex]);
|
||||
DisplayText(m_scriptSlices[m_ScriptIndex]);
|
||||
m_ScriptIndex++;
|
||||
StartCoroutine(SubtitleWait());
|
||||
}
|
||||
|
||||
|
||||
44
Assets/8_Scripts/1_Managers/UIManager.cs
Normal file
44
Assets/8_Scripts/1_Managers/UIManager.cs
Normal file
@@ -0,0 +1,44 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using TMPro;
|
||||
|
||||
public class UIManager : MonoBehaviour
|
||||
{
|
||||
[Header("Stat Text Objects")]
|
||||
public List<TMP_Text> m_StatText;
|
||||
|
||||
public TMP_Text m_ModelNameText;
|
||||
|
||||
private void OnEnable()
|
||||
{
|
||||
DReConRewards.m_UpdateStat += UpdateStatText;
|
||||
ModelManager.m_UpdateModelName += UpdateModelName;
|
||||
}
|
||||
|
||||
private void OnDisable()
|
||||
{
|
||||
DReConRewards.m_UpdateStat -= UpdateStatText;
|
||||
ModelManager.m_UpdateModelName -= UpdateModelName;
|
||||
}
|
||||
|
||||
private void UpdateStatText(float reward, int statIndex)
|
||||
{
|
||||
try
|
||||
{
|
||||
m_StatText[statIndex].text = reward.ToString("#.000");
|
||||
}
|
||||
catch
|
||||
{
|
||||
Debug.LogError($"Text object did not exist index: {statIndex}");
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateModelName(string modelName)
|
||||
{
|
||||
if( m_ModelNameText != null )
|
||||
{
|
||||
m_ModelNameText.text = modelName;
|
||||
}
|
||||
}
|
||||
}
|
||||
11
Assets/8_Scripts/1_Managers/UIManager.cs.meta
generated
Normal file
11
Assets/8_Scripts/1_Managers/UIManager.cs.meta
generated
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c0a7c3e427defe4418f938386d76b117
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user