// pass blockers also try to maintain distance to snap. However, we want to bias to kicking outside a little bit. // Solution is just have them do this for a second or two, then they move straight back to the QB. // Should depend on how far they start from the snap. // Calculate path straight to QB, calc path in arc. Take percentage. private void RUN_Set() { DEF_RushLog rRusher = FuncGetClosestRusher(FindObjectsOfType <PRAC_Def_Ply>(), transform.position); if (Vector3.Distance(transform.position, rRusher.transform.position) < mEngageDistance) { mState = STATE.S_Engaged; } // ---------------------- If they've gone far enough, then just have them stop so they don't crowd the QB. if (Time.time - mKickStartTime > mKickTimeLength) { cRigid.velocity = Vector3.zero; } else { // ---------------------- arc path. Vector3 vDirToQB = Vector3.Normalize(FindObjectOfType <PC_Controller>().transform.position - transform.position); Vector3 vDirToSnap = Vector3.Normalize(rRunAroundSpot - transform.position); Vector3 vSnapQBCross = Vector3.Cross(vDirToSnap, vDirToQB); Vector3 vBlockDir = Vector3.Cross(vSnapQBCross, vDirToSnap); // --------------------- percentage path/blend between Vector3 vActualPath = vBlockDir * mPercentKickOut + vDirToQB * (1f - mPercentKickOut); float fSpd = 0.5f + mPercentKickOut * 2f; cRigid.velocity = vActualPath * fSpd; } // but we want them looking at the rusher. Vector3 vDirToRusher = Vector3.Normalize(rRusher.transform.position - transform.position); // transform.forward = vDirToRusher; }
private void RUN_Engaged() { DEF_RushLog rRusher = FuncGetClosestRusher(FindObjectsOfType <PRAC_Def_Ply>(), transform.position); Vector3 vDis = rRusher.transform.position - transform.position; transform.forward = vDis.normalized; }
void Start() { base.Start(); cAth = GetComponent <PRAC_Ath>(); cZoneLog = GetComponent <DEF_ZoneLog>(); cTackLog = GetComponent <DEF_TackLog>(); cRushLog = GetComponent <DEF_RushLog>(); }
void Start() { cManLog = GetComponent <DEF_ManLog>(); cZoneLog = GetComponent <DEF_ZoneLog>(); cRushLog = GetComponent <DEF_RushLog>(); }