private bool canChase(SmartBat bat) { bool inView = Mathf.Abs(bat.bat.transform.position.z - disk.position.z) <= bat.fieldOfView; bool notOnDelay = bat.HitDelay == 0; return(inView && notOnDelay); }
private bool shouldChase(SmartBat bat, out float chaseForce) { float xPos = bat.bat.transform.position.x; if (xPos + bat.tolerance < disk.position.x) { chaseForce = bat.force; return(true); } else if (xPos - bat.tolerance > disk.position.x) { chaseForce = -bat.force; return(true); } else { chaseForce = 0; return(false); } }