Basically what I wanted to do was change out my hard variables to flexible ones that would change if one of the base variables were altered. Though, when I do this things are not working properly:
float thrusterTime = GameObject.Find("PlayerShip").GetComponent<ShipPlayerController>().thrusterTime;
float thrusterCooldown = GameObject.Find("PlayerShip").GetComponent<ShipPlayerController>().thrusterCooldown;
float num1 = 0.3f;
float num2 = (0.6f / thrusterCooldown);
float adjuster1 = thrusterTime * num1;
float adjuster2 = thrusterCooldown * num2;
if(cooldownActive == false)
{
gameObject.transform.localScale = new Vector3(adjuster1, 0.5f, 1);
if(thrusterTime <= 0.0f)
{
cooldownActive = true;
}
}
else if (cooldownActive == true)
{
gameObject.transform.localScale = new Vector3(adjuster2, 0.5f, 1);
if(thrusterCooldown <= 0.0f)
{
cooldownActive = false;
}
}
Variable num1 has the hard value of 0.3f, and what happens is that the object is scaling perfectly fine, but as with num2 the object is not scaling at all and I want it so that num1 and num2 will change depending on thrusterTime and thrusterCooldown.