public TeamReplay Create( LevelReplay parent, Course course, Labyrinths.LabyrinthObject labyrinth, Vector2Int startPosition) { TeamReplay replay = this.Create( labyrinth.GetLabyrinthPositionInWorldPosition(startPosition)); replay.parent = parent; replay.labyrinth = labyrinth; replay.material.color = course.Team.TeamColor; replay.backtrackMaterial.color = course.Team.TeamColor; replay.materialAlpha.color = course.Team.TeamColor.SetA(previousSegmentAlpha); replay.backtrackMaterialAlpha.color = course.Team.TeamColor.SetA(previousSegmentAlpha); replay.arrowHead.GetComponentInChildren <SpriteRenderer>().color = replay.material.color; replay.course = new CourseExecution(course, labyrinth); replay.states.Add(new State { PrevLPos = startPosition, LPos = startPosition, NextLPos = startPosition }); parent.OnResumeHandler += replay.OnResume; parent.OnStopHandler += replay.OnStop; parent.OnMoveIndexChangedHandler += replay.OnMoveIndexChanged; return(replay); }
public override void Clear() { algorithmSelection.Algorithm.OnValueChangedHandler -= OnAlgorithmChanged; teamToggle.OnCourseSelectedHandler -= OnCourseSelected; teamToggle.OnCourseToggledHandler -= OnCourseToggled; sidebar.IsToggleAlgorithm.OnValueChangedHandler -= OnAlgorithmToggled; sidebar.IsToggleGreyboxLabyrinth.OnValueChangedHandler -= OnGreyBoxToggled; base.Clear(); first = null; if (algorithmSequence != null) { algorithmSequence.OnMoveIndexChangedHandler -= algorithmSelection.OnAlgorithmMoveIndexChanged; algorithmSequence.gameObject.Destroy(); algorithmSequence = null; } if (labyrinthObject != null) { labyrinthObject.gameObject.Destroy(); labyrinthObject = null; } foreach (var team in playerSequences) { if (team.Value == null) { continue; } team.Value.gameObject.Destroy(); } playerSequences.Clear(); activeSequences.Clear(); teamToggle.OnReplayCourseRemoveAllHandler?.Invoke(); }
public override void Initialize() { base.Initialize(); // TODO playback controls.PlaybackSpeed = 2f; labyrinthObject = Labyrinths.Resources.Instance .GetLabyrinthObject(level.Labyrinth) .Create(level.Labyrinth); labyrinthObject.GenerateLabyrinthVisual(); labyrinthObject.Init(enableCamera: true); labyrinthObject.Camera.OutputToTexture = true; UI.ReplayDisplay.Instance.ViewRawImage.texture = labyrinthObject.Camera.RenderTexture; lposition = labyrinthObject.GetLabyrithStartPosition(); wposition = labyrinthObject.GetLabyrinthPositionInWorldPosition(lposition); algorithmSequence = Resources.Instance.AlgorithmSequence.Create( this, labyrinthObject, level.Algorithm, lposition ); algorithmSequence.OnMoveIndexChangedHandler += algorithmSelection.OnAlgorithmMoveIndexChanged; //algorithmSequence.OnChangedHandler += OnAlgorithmChanged; SetMoveCount(); //algorithmSelection.Algorithm.OnValueChangedHandler += (x) => algorithmSequence.Algorithm = x; foreach (Course course in level.Courses) { AddCourse(course); } }
public AlgorithmReplay Create( BaseReplay parent, Labyrinths.LabyrinthObject labyrinth, Algorithms.Algorithm algorithm, Vector2Int startPosition) { var replay = this.Create( labyrinth.GetLabyrinthPositionInWorldPosition(startPosition)); replay.parent = parent; replay.labyrinth = labyrinth; replay.lposition = startPosition; replay.startlposition = startPosition; replay.execution = new Algorithms.AlgorithmExecution(algorithm, labyrinth); parent.OnResumeHandler += replay.OnResume; parent.OnStopHandler += replay.OnStop; parent.OnMoveIndexChangedHandler += replay.OnMoveIndexChanged; return(replay); }