// Make sure that we gather up the play and then save it public void BT_SaveSet() { // Let me go ahead and try to add up all the things in the scene. mSet.mRecs.Clear(); mSet.mHoops.Clear(); ED_RP_Hp[] hoops = FindObjectsOfType <ED_RP_Hp>(); foreach (ED_RP_Hp h in hoops) { DT_RP_Hoop dh = new DT_RP_Hoop(); dh.mTag = h.mTag; dh.mSize = 1f; Vector3 vStart = new Vector3(); vStart.y = 1f; vStart.x = h.mIxX - rSnap.mIxX; vStart.z = h.mIxY - rSnap.mIxY; // convert grid coordinates to starting position... dh.mStart = vStart; mSet.mHoops.Add(dh); } ED_RP_Rec[] recs = FindObjectsOfType <ED_RP_Rec>(); foreach (ED_RP_Rec r in recs) { DT_RP_Rec dr = new DT_RP_Rec(); dr.mTag = r.mTag; Vector3 vStart = new Vector3(); vStart.y = 1f; vStart.x = r.mIxX - rSnap.mIxX; vStart.z = r.mIxY - rSnap.mIxY; // convert grid coordinates to starting position... dr.mStart = vStart; mSet.mRecs.Add(dr); } Debug.Log("Num Recs: " + mSet.mRecs.Count + ", Num Hoops: " + mSet.mHoops.Count + ", Num Routes: " + mSet.mRoutes.Count); IO_RP.FWriteSet(mSet); }
void Start() { mUI = GetComponent <RP_UI>(); cRouteDrawer = GetComponent <RP_DrawRoutes>(); mSet = IO_RP.FLoadSet("Slants"); // Unfortunately, the destroyed receivers and hoops are still around, so we can't get references this frame. // Instead, do this on exitIntro. rPC = FindObjectOfType <PC_Controller>(); rPocket = FindObjectOfType <RP_ThrowSpot>(); TDC_EventManager.FAddHandler(TDC_GE.GE_BallHitGround, E_BallHitGround); TDC_EventManager.FAddHandler(TDC_GE.GE_InPocket, E_PocketEntered); TDC_EventManager.FAddHandler(TDC_GE.GE_OutPocket, E_PocketExited); TDC_EventManager.FAddHandler(TDC_GE.GE_QB_ReleaseBall, E_BallThrown); TDC_EventManager.FAddHandler(TDC_GE.GE_BallCaught_Rec, E_BallCaught_Rec); mCompletions = new List <string>(); ENTER_INTRO(); }