Пример #1
0
    // Spawn in a default play, with nothing in it, so we can edit that play.
    public void OnNewPlay()
    {
        cLoader.FLoadPlay(IO_PlayList.FLOAD_PLAY_BY_NAME(mDefaultPlay));

        // AND NOW WE HAVE TO WRITE SOMETHING LIKE: DISPLAYPLAY();
        cJobDisplayer.FDisplayJobs();
    }
Пример #2
0
    public void FDisplayPlay()
    {
        DATA_Play ply = IO_PlayList.FLOAD_PLAY_BY_NAME(mPlayName);

        if (ply == null)
        {
            Debug.Log("That play doesn't exist");
            return;
        }

        foreach (DT_PlayerRole guy in ply.mPlayerRoles)
        {
            var     clone     = Instantiate(GFX_Player, transform.position, transform.rotation);
            Vector2 vGFXSpawn = new Vector2();
            vGFXSpawn = guy.mStart;
            // Now we do this conversion for the 1000x time.
            vGFXSpawn *= rField.GetComponent <RectTransform>().rect.width / 50f;     // field is 50 meters.
            vGFXSpawn += (Vector2)rField.transform.position;
            vGFXSpawn *= 1000f;
            GFX_Player gfx = clone.GetComponentInChildren <GFX_Player>();
            Debug.Log("Current transform: " + gfx.GetComponent <RectTransform>().position);
            clone.GetComponentInChildren <RectTransform>().position = vGFXSpawn;
            clone.transform.position = vGFXSpawn;
            Debug.Log("New transform: " + gfx.GetComponent <RectTransform>().position);
        }
    }
Пример #3
0
    // ----------------------------- PRESNAP STATES
    private void RUN_SnapReady()
    {
        if (Input.GetKeyDown(KeyCode.Space))
        {
            FindObjectOfType <PC_Controller>().mState = PC_Controller.PC_STATE.SACTIVE;

            PRAC_Ath[] athletes = FindObjectsOfType <PRAC_Ath>();
            for (int i = 0; i < athletes.Length; i++)
            {
                athletes[i].mState = PRAC_Ath.PRAC_ATH_STATE.SDOING_JOB;
            }

            // For now so it's not there when we run. Going to change this soon.
            cShowDefence.FStopShowingPlayArt();
            mState = PRAC_STATE.SPLAY_RUNNING;
        }

        // We also need the camera to go to the higher perspective.
        if (Input.GetKeyDown(KeyCode.T))
        {
            cShowDefence.FStopShowingPlayArt();
            cShowDefence.FShowAllPlayRoles(IO_PlayList.FLOAD_PLAY_BY_NAME(rPracUI.mOffensivePlayName.text), IO_DefPlays.FLOAD_PLAY_BY_NAME(rPracUI.mDefensivePlayName.text), rSnapSpot);
            FindObjectOfType <CAM_PlayShowing>().FActivate();
            mPreSnapState = PRESNAP_STATE.SHIGHCAM;
        }
    }
Пример #4
0
    public void OnPlaySaved()
    {
        if (rPlayNameField.text == string.Empty)
        {
            Debug.Log("Trying to save un-named play");
            return;
        }

        // 2 stages
        // convert to DATA_Play
        // write that to disk
        IO_PlayList.FWRITE_PLAY(cSaver.FConvertPlayToDATA(rPlayNameField.text));
    }
Пример #5
0
    void Start()
    {
        IO_DefPlays.FLOAD_PLAYS();
        IO_PlayList.FLOAD_PLAYS();
        IO_RouteList.FLOAD_ROUTES();
        IO_Settings.FLOAD_SETTINGS();
        IO_ZoneList.FLOAD_ZONES();

        mDebugText.text = "Loading in stuffs";

        // IO_RouteList.FWRITE_ALL_ROUTES_AS_TEXT();
        DeleteOldFilesFromPlayArtDirectories();
        TransferCurrentFormationsAndPlaysIntoPlayArtDirectories();

        mDebugText.text = "Should have transfered text files with formation and plays";

        mState = SplashState.SLOGO;
        mAudioMixer.SetFloat("MASTER_VOLUME", IO_Settings.mSet.lMasterVolume);

        ENTER_Logo();
    }
Пример #6
0
    void Start()
    {
        cPlaySetter  = GetComponent <PRAC_SetUpPlay>();
        cShowDefence = GetComponent <PRAC_ShowDefense>();

        mState         = PRAC_STATE.SPOST_PLAY;
        mPreSnapState  = PRESNAP_STATE.SREADYTOSNAP;
        mPickPlayState = PICKPLAY_STATE.SOFFENSE;
        IO_PlayList.FLOAD_PLAYS();
        IO_DefPlays.FLOAD_PLAYS();
        IO_ZoneList.FLOAD_ZONES();

        IO_RouteList.FLOAD_ROUTES();

        PRS_AssignMan.FLOAD_PRIORITIES();

        // Won't affect the build, but will affect the editor.
        IO_Settings.FLOAD_SETTINGS();
        // IO_RouteList.FCONVERT_TO_TEXT_FILES();
        // IO_PlayList.FCONVERT_TO_TEXT_FILES();
        // IO_DefPlays.FCONVERT_TO_TEXT_FILES();
        // IO_ZoneList.FCONVERT_TO_TEXT_FILES();
        MN_PauseScreen.SetActive(false);
    }
Пример #7
0
 void Start()
 {
     IO_RouteList.FLOAD_ROUTES();
     IO_PlayList.FLOAD_PLAYS();
 }
Пример #8
0
    // For now we are ignoring the defensive play name.
    public void FSetUpPlay(string sOffName, string sDefName, PLY_SnapSpot rSnapSpot)
    {
        // ------------------------------- LOAD IN PLAYERS
        DATA_Play playToRun = IO_PlayList.FLOAD_PLAY_BY_NAME(sOffName);

        if (playToRun == null)
        {
            Debug.Log("No play of that name");
        }

        // Now we just pretend there were no issues, so we put our players in their spots.
        for (int i = 0; i < playToRun.mPlayerRoles.Length; i++)
        {
            Vector3 vPlayerSpot = new Vector3();
            vPlayerSpot.x = playToRun.mPlayerRoles[i].mStart.x;
            vPlayerSpot.z = playToRun.mPlayerRoles[i].mStart.y;
            vPlayerSpot  += rSnapSpot.transform.position;
            var clone = Instantiate(PF_OffensivePlayer, vPlayerSpot, transform.rotation);
            clone.mJob.mTag    = playToRun.mPlayerRoles[i].mTag;
            clone.mJob.mRole   = playToRun.mPlayerRoles[i].mRole;
            clone.mJob.mDetail = playToRun.mPlayerRoles[i].mDetail;
        }

        int randomDefPlay = Random.Range(0, IO_DefPlays.mPlays.Length);
        // DATA_Play defPlay = IO_DefPlays.mPlays[randomDefPlay];
        DATA_Play defPlay = IO_DefPlays.FLOAD_PLAY_BY_NAME(sDefName);
        PRAC_UI   ui      = FindObjectOfType <PRAC_UI>();

        ui.mDefensivePlayName.text = defPlay.mName;

        // spawn a defensive player according to the play.
        for (int i = 0; i < defPlay.mPlayerRoles.Length; i++)
        {
            Vector3 vPlayerSpot = new Vector3();
            vPlayerSpot.x = defPlay.mPlayerRoles[i].mStart.x;
            vPlayerSpot.z = defPlay.mPlayerRoles[i].mStart.y;
            vPlayerSpot  += rSnapSpot.transform.position;
            var clone = Instantiate(PF_DefensivePlayer, vPlayerSpot, transform.rotation);
            clone.mJob.mTag    = defPlay.mPlayerRoles[i].mTag;
            clone.mJob.mRole   = defPlay.mPlayerRoles[i].mRole;
            clone.mJob.mDetail = defPlay.mPlayerRoles[i].mDetail;
        }

        // --------------------------------------------- Set all athletes to waiting for snap.
        PRAC_Ath[] athletes = FindObjectsOfType <PRAC_Ath>();
        foreach (PRAC_Ath athlete in athletes)
        {
            athlete.mState = PRAC_Ath.PRAC_ATH_STATE.SPRE_SNAP;
        }


        // --------------------------------------------- Re-arrange offensive and defensive player pointers left->right.
        PRAC_Off[] offenders = FindObjectsOfType <PRAC_Off>();
        PRAC_Def[] defenders = FindObjectsOfType <PRAC_Def>();
        SortPlayersLeftToRight(offenders);
        SortPlayersLeftToRight(defenders);


        // -------------------------------------- For route runners, load in their routes.
        IO_RouteList.FLOAD_ROUTES();
        for (int i = 0; i < offenders.Length; i++)
        {
            if (offenders[i].mJob.mRole == "Route")
            {
                // Yep, memory not allocated error if we don't do this here.
                offenders[i].GetComponent <OFF_RouteLog>().mRouteSpots = new List <Vector3>();

                DATA_Route rt = IO_RouteList.FLOAD_ROUTE_BY_NAME(offenders[i].mJob.mDetail);
                foreach (Vector2 routeSpot in rt.mSpots)
                {
                    Vector3 vSpot = offenders[i].transform.position;
                    vSpot.x += routeSpot.x; vSpot.z += routeSpot.y;
                    // Also, shove the spot into the receiver, just for now.
                    offenders[i].GetComponent <OFF_RouteLog>().mRouteSpots.Add(vSpot);
                    // Instantiate(PF_RouteNode, vSpot, transform.rotation);
                }
            }
        }

        // ---------------------------------------------------------- Shove the player "into" the QB character.
        for (int i = 0; i < offenders.Length; i++)
        {
            if (offenders[i].mJob.mTag == "QB")
            {
                Vector3 vSpot = offenders[i].transform.position;
                vSpot.y = 1f;
                FindObjectOfType <PC_Controller>().transform.position = vSpot;
            }
        }

        // ------------------------------------------ Now we're assigning the man for man coverage.
        // An offense has 5 eligible receivers on every play, so we actually SHOULD go by that, not their routes.
        // Update, we've added PRS_AssignMan which globally stores the order that tags should be covered, and the same for defense.

        List <PRAC_Off> elibibleRecs = new List <PRAC_Off>();

        foreach (PRAC_Off off in offenders)
        {
            if (PRS_AssignMan.FELIGIBLE_RECEIVER(off.mJob.mTag))
            {
                elibibleRecs.Add(off);
            }
        }

        elibibleRecs = PRS_AssignMan.FSORT_RECEIVER_IMPORTANCE(elibibleRecs);

        List <PRAC_Def> defsInMan = new List <PRAC_Def>();

        foreach (PRAC_Def def in defenders)
        {
            if (def.mJob.mRole == "Man")
            {
                Debug.Log("Added");
                defsInMan.Add(def);
            }
        }

        defsInMan = PRS_AssignMan.FSORT_DEFENDER_IMPORTANCE(defsInMan);

        // Now we finally start assigning man coverage responsibility.
        for (int i = 0; i < defsInMan.Count; i++)
        {
            if (elibibleRecs.Count <= 0)
            {
                break;
            }

            defsInMan[i].GetComponent <DEF_ManLog>().rMan = elibibleRecs[0];
            elibibleRecs.RemoveAt(0);
        }

        // ---------- ALIGN MAN DEFENDERS TO THE GUY THEY'RE COVERING
        for (int i = 0; i < defsInMan.Count; i++)
        {
            Vector3 vManPos = defsInMan[i].GetComponent <DEF_ManLog>().rMan.transform.position;
            vManPos.z += 7f;
            defsInMan[i].transform.position = vManPos;
        }
    }