Beispiel #1
0
    // Basically, they're not done running the route yet, but they are looking for the ball.
    private void RUN_CanReactToThrowWhileRunningRoute()
    {
        if (mRouteSpots.Count <= 0)
        {
            ENTER_GetOpen();
            return;
        }
        Vector3 dis = mRouteSpots[0] - transform.position;

        dis.y = 0f;
        dis   = Vector3.Normalize(dis);
        Vector3 vAcc = cAcc.FCalcAccFunc(dis, cAcc.mSpd);

        cRigid.velocity += vAcc;
        if (cRigid.velocity.magnitude > cAcc.mSpd)
        {
            cRigid.velocity *= cAcc.mSpd / cRigid.velocity.magnitude;
        }
        transform.forward = cRigid.velocity.normalized;

        if (Vector3.Distance(mRouteSpots[0], transform.position) < 2f)
        {
            mRouteSpots.RemoveAt(0);
        }

        // Somewhere here, if we find the ball is being thrown to us, we need to enter a state where we just
        // try to get that ball.
        if (cAth.FCheckIfBallThrown())
        {
            ENTER_TryCatchBall();
        }
    }
Beispiel #2
0
    // At some point, if they get close, then have them try to cheat
    // to the QB.
    private void RUN_GetToSpot()
    {
        // make it run to it's zone spot every time.
        Vector3 dis = mZoneSpot - transform.position;

        dis.y = 0f;
        Vector3 disNorm = Vector3.Normalize(dis);

        Vector3 vAcc = cAcc.FCalcAccFunc(disNorm, cAcc.mSpd);

        cRigid.velocity += vAcc;
        if (cRigid.velocity.magnitude > cAcc.mSpd)
        {
            cRigid.velocity *= cAcc.mSpd / cRigid.velocity.magnitude;
        }
        transform.forward = cRigid.velocity.normalized;

        if (cAth.FCheckIfBallThrown())
        {
            ENTER_TryCatchBall();
        }

        if (dis.magnitude < 10f)
        {
            ENTER_ReadQBEyes();
        }
    }