Exemplo n.º 1
0
    private void RUN_BlindlyFollowing()
    {
        // If they've made the last move, and are decently close to the destination.
        if (mRouteSpots.Count <= 1)
        {
            if (Vector3.Distance(transform.position, mRouteSpots[mRouteSpots.Count - 1]) < 10f)
            {
                ENTER_CanReactToThrow();
                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)
        {
            Debug.Log("Removing");
            mRouteSpots.RemoveAt(0);
        }
    }
Exemplo n.º 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();
        }
    }
Exemplo n.º 3
0
    // Hack, just increase z for now.
    public void FRunWithBall()
    {
        // Debug.Log("Here");

        Vector3 vDir = new Vector3(0f, 0f, 1f);
        Vector3 vAcc = cAcc.FCalcAccFunc(vDir, cAcc.mSpd);

        cRigid.velocity += vAcc;
        if (cRigid.velocity.magnitude > cAcc.mSpd)
        {
            cRigid.velocity *= cAcc.mSpd / cRigid.velocity.magnitude;
        }
        transform.forward = cRigid.velocity.normalized;
    }
Exemplo n.º 4
0
    public void FRun()
    {
        // Depends if they're running towards or away from me. -- MAYBE
        // Only matters when I add moves into the game. Then, if behind, always chase down full speed.
        // But if ahead, then maybe hold up so you don't get deked out.
        PRAC_Ath rBallCarrier = cAth.rMan.FGetBallCarrier();

        if (rBallCarrier == null)
        {
            return;
        }
        // Say, run to where they're going to be, in one second, unless you're within 5 m, then shorten that time proportionally.
        float fLeadPerc = 0f;
        float fDis      = Vector3.Distance(transform.position, rBallCarrier.transform.position);

        if (fDis > 5f)
        {
            fLeadPerc = 1f;
        }
        else
        {
            fLeadPerc = 5f / fDis;
        }

        Vector3 vSpotToMoveTo = rBallCarrier.transform.position;

        vSpotToMoveTo += rBallCarrier.GetComponent <Rigidbody>().velocity *fLeadPerc;              // so move 1 second ahead of them, unless we're really close.

        // they also need to be keeping the endzone between them and the ball carrier.

        Vector3 vDir = vSpotToMoveTo - transform.position;

        vDir = Vector3.Normalize(vDir);
        Vector3 vAcc = cAcc.FCalcAccFunc(vDir, cAcc.mSpd);

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