Hi, I’d appreciate some help. I’m trying to call a function but it won’t let me because it can’t find it.
This is where the functions are defined:
public void ThrustUp()
{
m_parentDriller.rigidbody2D.AddForceAtPosition(thrust, transform.position);
CreateThrust(transform.position + transform.up*-0.5f, transform.up*-4.0f, 1.0f);
m_diller.CurrentHeat += thrustHeatAmount;
}
public void ThrustDown()
{
m_parentDriller.rigidbody2D.AddForceAtPosition(-thrust, transform.position);
CreateThrust(transform.position + transform.up * 0.2f + transform.right * 0.4f, transform.up * 3.0f, 0.5f);
CreateThrust(transform.position + transform.up * 0.2f - transform.right * 0.4f, transform.up * 3.0f, 0.5f);
m_diller.CurrentHeat += thrustHeatAmount;
}
This is where they are called:
if (transformCache.position.y > 1)
{
driller.ThrustUp();
}
if (transformCache.position.y < 1)
{
driller.ThrustDown();
}
This is also in the script above:
public GameObject driller = GameObject.Find("DrillerEngine");