no damn clue why this isn’t working, everything i try results in failure.
i need heavyBreathing to play when fatigue is below 25, and breathing to play when it’s between 75 and 25
i confirmed that it IS changing the audio clips just fine by watching the inspector…
but NO MATTER WHAT. it NEVER plays heavyBreathing unless i remove the other if statement. what do?
var breathing : AudioClip;
var heavyBreathing : AudioClip;
static var currentaudioTime : float; // What the current time is.
static var audioLength : float; // The length of the clip.
static var timeLeft : float;
//static var timeLeftHB : int; // how much time remains in heavy breathing.
//static var timeLeftB: int; //how much time remains in breathing;
var Player : GameObject;
Player = GameObject.Find("Capsule");
var thirstyMouth : AudioClip;
function Update ()
{
timeLeft = audioLength - currentaudioTime;
if (Player.GetComponent(Character_effects).fatigue <= 25 Player.GetComponent(Character_effects).fatigue >=0)
{
audio.clip = heavyBreathing;
Debug.Log("time left: " + timeLeft);
audioLength =audio.clip.length;
currentaudioTime = audio.time;
//timeLeftHB = audioLength - currentaudioTime;
if(timeLeft <= 0)
{
audio.Play();
timeLeft = -1;
}
}
//the above heavy breathing script only functions when this lower one is disabled
//this lower one originally played a more mild breathing sound when fatigue dropped below 75
if (Player.GetComponent(Character_effects).fatigue <= 75 Player.GetComponent(Character_effects).fatigue >=25)
{
audio.clip = breathing;
Debug.Log("time left: " + timeLeft);
audioLength = audio.clip.length;
currentaudioTime = audio.time;
//timeLeftB = audioLength - currentaudioTime;
if(timeLeft <=0)
{
audio.Play();
}
}
}