diff --git a/Assets/MirageXR/Player/Prefabs/eROBSON/Prefabs/o9_bargraph.prefab b/Assets/MirageXR/Player/Prefabs/eROBSON/Prefabs/o9_bargraph.prefab
index a02f2f74c..a06464cc8 100644
--- a/Assets/MirageXR/Player/Prefabs/eROBSON/Prefabs/o9_bargraph.prefab
+++ b/Assets/MirageXR/Player/Prefabs/eROBSON/Prefabs/o9_bargraph.prefab
@@ -341,7 +341,7 @@ GameObject:
- component: {fileID: 3602013116561168751}
- component: {fileID: 8365970246065829508}
m_Layer: 0
- m_Name: Line003
+ m_Name: led5
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -507,7 +507,7 @@ GameObject:
- component: {fileID: 2250746998940470243}
- component: {fileID: 3878434631385909016}
m_Layer: 0
- m_Name: Line005
+ m_Name: led4
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -590,7 +590,7 @@ GameObject:
- component: {fileID: 6502004952187121599}
- component: {fileID: 1276829913763581589}
m_Layer: 0
- m_Name: Line007
+ m_Name: led3
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -839,7 +839,7 @@ GameObject:
- component: {fileID: 7408299993418523812}
- component: {fileID: 7380300605935270615}
m_Layer: 0
- m_Name: Line011
+ m_Name: led1
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -1287,7 +1287,7 @@ GameObject:
- component: {fileID: 6127392726229386877}
- component: {fileID: 8225208080581790013}
m_Layer: 0
- m_Name: Line009
+ m_Name: led2
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
@@ -1404,6 +1404,7 @@ GameObject:
- component: {fileID: 5018361853446732302}
- component: {fileID: 5104182535571999677}
- component: {fileID: 484503428188708966}
+ - component: {fileID: 91869103912858566}
m_Layer: 0
m_Name: o9_bargraph
m_TagString: Untagged
@@ -1584,6 +1585,26 @@ AudioSource:
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
+--- !u!114 &91869103912858566
+MonoBehaviour:
+ m_ObjectHideFlags: 0
+ m_CorrespondingSourceObject: {fileID: 0}
+ m_PrefabInstance: {fileID: 0}
+ m_PrefabAsset: {fileID: 0}
+ m_GameObject: {fileID: 8503723872563970172}
+ m_Enabled: 1
+ m_EditorHideFlags: 0
+ m_Script: {fileID: 11500000, guid: 7aa4ce0f82cc57145a4ca433e2a551c9, type: 3}
+ m_Name:
+ m_EditorClassIdentifier:
+ lightRenderers:
+ - {fileID: 7380300605935270615}
+ - {fileID: 8225208080581790013}
+ - {fileID: 1276829913763581589}
+ - {fileID: 3878434631385909016}
+ - {fileID: 8365970246065829508}
+ onMaterial: {fileID: 2100000, guid: 57315aa7aea1fd948b6f2ead88d80900, type: 2}
+ offMaterial: {fileID: 2100000, guid: 877908f016616ae409870e24c1a4147b, type: 2}
--- !u!1 &8824843978635763748
GameObject:
m_ObjectHideFlags: 0
diff --git a/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BargraphController.cs b/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BargraphController.cs
new file mode 100644
index 000000000..efdffccc9
--- /dev/null
+++ b/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BargraphController.cs
@@ -0,0 +1,62 @@
+using UnityEngine;
+
+public class BargraphController : MonoBehaviour
+{
+ [SerializeField] private Renderer[] lightRenderers;
+ [SerializeField] private Material onMaterial;
+ [SerializeField] private Material offMaterial;
+
+
+ ///
+ /// turn on the bargraph light depends on the power
+ ///
+ /// is connected or not
+ /// the power received to this bit
+ public void TurnOnLights(bool status, float power)
+ {
+ // Turn off all lights first
+ TurnOffAllLights();
+
+ //bit is disconnected
+ if (!status)
+ {
+ return;
+ }
+
+ // Determine how many lights to turn on based on the power level
+ var lightsToTurnOn = power switch
+ {
+ > 0f and <= 0.2f => 1,
+ > 0.2f and <= 0.4f => 2,
+ > 0.4f and <= 0.6f => 3,
+ > 0.6f and <= 0.8f => 4,
+ > 0.8f and <= 1.0f => 5,
+ _ => 0
+ };
+
+ // Turn on the appropriate number of lights
+ for (var i = 0; i < lightsToTurnOn; i++)
+ {
+ lightRenderers[i].material = onMaterial;
+ }
+ }
+
+
+ private void Start()
+ {
+ TurnOffAllLights();
+ }
+
+
+
+ ///
+ /// Turn off all lights first
+ ///
+ private void TurnOffAllLights()
+ {
+ foreach (var led in lightRenderers)
+ {
+ led.material = offMaterial;
+ }
+ }
+}
\ No newline at end of file
diff --git a/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BargraphController.cs.meta b/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BargraphController.cs.meta
new file mode 100644
index 000000000..c3aad6370
--- /dev/null
+++ b/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BargraphController.cs.meta
@@ -0,0 +1,11 @@
+fileFormatVersion: 2
+guid: 7aa4ce0f82cc57145a4ca433e2a551c9
+MonoImporter:
+ externalObjects: {}
+ serializedVersion: 2
+ defaultReferences: []
+ executionOrder: 0
+ icon: {instanceID: 0}
+ userData:
+ assetBundleName:
+ assetBundleVariant:
diff --git a/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BitsBehaviourController.cs b/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BitsBehaviourController.cs
index 50a05c53c..aef448b10 100644
--- a/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BitsBehaviourController.cs
+++ b/Assets/MirageXR/Player/Prefabs/eROBSON/Scripts/BitsBehaviourController.cs
@@ -366,6 +366,7 @@ private async void BitActionToggle(eROBSONItems bit, bool status)
await ControlBuzzerSound(bit, status, averageValue);
break;
case BitID.O9BARGRAPH:
+ await ControlBarGraph(bit, status, averageValue);
break;
case BitID.O13FAN:
case BitID.O25DCMOTOR:
@@ -386,6 +387,13 @@ private async void BitActionToggle(eROBSONItems bit, bool status)
+ ///
+ /// Turn on/off the led light
+ ///
+ ///
+ ///
+ ///
+ ///
private async Task ControlLedLight(eROBSONItems bit, bool status, float averageValue)
{
var light = bit.GetComponentInChildren();
@@ -410,6 +418,13 @@ private async Task ControlLedLight(eROBSONItems bit, bool status, float averageV
+ ///
+ /// control the buzzer and play the buzz sound regarding to the power
+ ///
+ ///
+ ///
+ ///
+ ///
private async Task ControlBuzzerSound(eROBSONItems bit, bool status, float averageValue)
{
var audios = bit.GetComponentsInChildren();
@@ -434,6 +449,26 @@ private async Task ControlBuzzerSound(eROBSONItems bit, bool status, float avera
+ ///
+ /// Control the bargraph and turn on/off the lights
+ ///
+ ///
+ ///
+ ///
+ private async Task ControlBarGraph(eROBSONItems bit, bool status, float averageValue)
+ {
+ bit.TryGetComponent(out var bargraphController);
+ if (!bargraphController)
+ {
+ return;
+ }
+
+ var power = averageValue / 2; //normalized
+ bargraphController.TurnOnLights(status, power);
+
+ await Task.CompletedTask;
+ }
+