Exemple #1
0
    public void E_RunnerTackled()
    {
        if (cMan.FGetBallCarrier() == null)
        {
            Debug.Log("Nobody has ball");
            return;
        }
        PRAC_Off_Ply guyWithBall = cMan.FGetBallCarrier().GetComponent <PRAC_Off_Ply>();

        if (guyWithBall.mState == PRAC_Ath.PRAC_ATH_STATE.STACKLED || guyWithBall.mState == PRAC_Ath.PRAC_ATH_STATE.SRUN_WITH_BALL)
        {
            mInfo.mWasTackled  = true;
            mInfo.mTackleSpot  = guyWithBall.transform.position.z;            // should convert to field position. eg. HOME 35.
            mInfo.mYardsGained = Mathf.Abs(cMan.rSnapSpot.transform.position.z - guyWithBall.transform.position.z);
            Debug.Log("Yards gained: " + mInfo.mYardsGained);
        }

        cMan.cAud.FTackle();
        mCountdownActive = true;
        mCountdownTimer  = 3f;
    }
Exemple #2
0
    void OnTriggerEnter(Collider other)
    {
        PRAC_Off_Ply p = UT_FindComponent.FindComponent <PRAC_Off_Ply>(other.gameObject);

        if (p != null)
        {
            if (p.mState != PRAC_Ath.PRAC_ATH_STATE.STACKLED)
            {
                Debug.Log(p.mState);
                if (p == cAth.rMan.FGetBallCarrier())
                {
                    Debug.Log("Tackle the offensive player");
                    p.FENTER_Tackled();
                    TDC_EventManager.FBroadcast(TDC_GE.GE_Tackled);
                }
                else
                {
                    Debug.Log("Wasn't the ball carrier");
                }
            }
        }
    }
Exemple #3
0
 void Start()
 {
     cAthlete  = GetComponent <PRAC_Off_Ply>();
     cAnimator = GetComponentInChildren <Animator>();
 }
Exemple #4
0
    public override void FExit()
    {
        Cursor.lockState = CursorLockMode.Locked;
        mUI.gameObject.SetActive(false);
        Cursor.visible = false;

        // Get references to all the players in the scene.
        PRAC_Ath[] athletes = FindObjectsOfType <PRAC_Ath>();
        Debug.Log("Num aths: " + athletes.Length);
        cMan.rAths.Clear();
        foreach (PRAC_Ath a in athletes)
        {
            cMan.rAths.Add(a);
        }

        if (!cMan.mLineExists || !cMan.mOlineExists)
        {
            for (int i = 0; i < cMan.rAths.Count; i++)
            {
                PRAC_Off_Ply p = cMan.rAths[i].GetComponent <PRAC_Off_Ply>();
                if (p != null)
                {
                    if (p.mRole == "BLOCK")
                    {
                        Destroy(p.gameObject);
                        cMan.rAths.RemoveAt(i);
                        i--;
                    }
                }
            }
        }
        Debug.Log("Count: " + cMan.rAths.Count);
        // now defense as well.
        if (cMan.mDefenseExists)
        {
            if (!cMan.mLineExists)
            {
                for (int i = 0; i < cMan.rAths.Count; i++)
                {
                    PRAC_Def_Ply p = cMan.rAths[i].GetComponent <PRAC_Def_Ply>();
                    if (p != null)
                    {
                        if (p.mJob.mRole == "Pass Rush")
                        {
                            Destroy(p.gameObject);
                            cMan.rAths.RemoveAt(i);
                            i--;
                        }
                    }
                }
            }
            else            // have to shove them all back 1 yard.
            {
                for (int i = 0; i < cMan.rAths.Count; i++)
                {
                    PRAC_Def_Ply p = cMan.rAths[i].GetComponent <PRAC_Def_Ply>();
                    if (p != null)
                    {
                        if (p.mJob.mRole == "Pass Rush")
                        {
                            Vector3 vPos = p.transform.position;
                            vPos.z += 2f;
                            p.transform.position = vPos;
                        }
                    }
                }
            }
        }
        Debug.Log("Count: " + cMan.rAths.Count);

        // Get rid of the QB
        {
            for (int i = 0; i < cMan.rAths.Count; i++)
            {
                PRAC_Off_Ply p = cMan.rAths[i].GetComponent <PRAC_Off_Ply>();
                if (p != null)
                {
                    if (p.mRole == "QB")
                    {
                        Destroy(p.gameObject);
                        cMan.rAths.RemoveAt(i);
                        i--;
                    }
                }
            }
        }
        Debug.Log("Count: " + cMan.rAths.Count);

        mFrameWasted = true;
    }