public void SetupSession(TrainingSessionData sessionData) { shotSession = (ShotSessionData)sessionData; shootInterval = shotSession.shootInterval; shotTasks = shotSession.shotTaskList.ToArray(); currentShotTaskIndex = 0; previousShotTask = null; currentShotTask = shotTasks[currentShotTaskIndex]; nextShotTask = currentShotTaskIndex + 1 < shotTasks.Length ? shotTasks[currentShotTaskIndex + 1] : null; shotSession.MaximumScore = GetMaxScore(shotSession); queuedBalls = Utility.CreateMonoBehaviourPool <TennisBall>(ballPrefab, numberPooledBalls, trainingBallsParent); ballMachine.MoveTo(currentShotTask.BallMachineShot.StartPosition); ballMachine.AimAt(currentShotTask.BallMachineShot.TargetPosition); shotZoneHighlighter.ScaleAndPositionZone(currentShotTask.TaskCourtZone); shotZoneHighlighter.ColourZone(currentShotTask.TaskShotType); shotSessionEventRelay.ChangeTask(currentShotTask); shotSessionEventRelay.ChangeProgress(0); shotSessionEventRelay.ChangeScore(0); shotSessionEventRelay.ChangeCombo(0); gameObject.SetActive(true); }
private void InitProgram() { if (trainingEventRelay.CurrentProgram) { trainingProgram = trainingEventRelay.CurrentProgram; } else { trainingProgram = fallBackProgram; trainingEventRelay.CurrentProgram = fallBackProgram; } trainingProgram.ResetProgress(); trainingProgram.ResetScores(); trainingSessions = trainingProgram.trainingSessions; currentSessionIndex = 0; currentSession = trainingSessions[0]; trainingEventRelay.ShowSessionOverview(currentSession); this.DoSequence(new Func <float>[] { () => 1f, () => { SetupSessionCoordinator(currentSession); return(0f); } }); }
private void ShowSessionOverview(TrainingSessionData sessionData) { titleText.text = sessionData.sessionName; startSessionButton.DescriptionText.text = sessionData.description; // TODO rest of session data in sub menus ShowWindow(true, true); }
private void SetupSessionCoordinator(TrainingSessionData sessionData) { Type sessionType = sessionData.GetType(); if (sessionType == typeof(ShotSessionData)) { currentSessionCoordinator = shotSessionCoordinator; currentSessionCoordinator.SetupSession(sessionData); return; } // add handling more coordinators in the future }
private void SetupNextSession() { currentSessionIndex += 1; currentSession = trainingSessions[currentSessionIndex]; this.DoSequence(new Func <float>[] { () => { ShowMessage("Next Session!"); return(2f); }, () => { trainingEventRelay.ShowSessionOverview(currentSession); currentSessionCoordinator.CleanupSession(); SetupSessionCoordinator(currentSession); return(0f); } }); }
public void ShowSessionOverview(TrainingSessionData sessionData) { OnShowSessionOverview?.Invoke(sessionData); }