Hello, I have a problem with the management of my code, I would like that once my variable is satisfied, objects are activated in the scene.
The problem is that once activated these objects require a few seconds to perform their transformations, so I would like the script to give priority to reach the completion of the transformation and then resume the reading of the values that takes place through a bitalino in real-time, and if these values no longer reflect this range, then it returns to change the range.
This is the code:
private void ReadValue(int[][] packageOfData, int chnIndex)
{
for (int i = 0; i < packageOfData.Length; i++)
{
// First stage condition (High level of stress)
if (packageOfData[i][chnIndex] < 1000 && packageOfData[i][chnIndex] > 800)
{
time += Time.deltaTime;
if (time >= 6.0f)
{
if (Aura != null)
{
Aura.SetActive(false);
}
if (AuraGlow != null)
{
AuraGlow.SetActive(false);
}
if (DirectionalLight != null)
{
DirectionalLight.transform.rotation = Quaternion.Slerp(point0.rotation, pointA.rotation, timeCount);
timeCount = timeCount + Time.deltaTime*Rotation_Smoothness_Sun;
}
if (RustGarden1 != null)
{
Quaternion_Rotate_From = RustGarden1.transform.rotation;
Quaternion_Rotate_To = Quaternion.Euler (0,20,0);
RustGarden1.transform.rotation = Quaternion.Lerp (Quaternion_Rotate_From, Quaternion_Rotate_To, Time.deltaTime*Rotation_Smoothness);
}
}
else
{
time = 0.0f;
//ReadValue(int[][] packageOfData, int chnIndex);
}
}
}
}