예제 #1
0
    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);
    }
예제 #2
0
    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);
        }
    }