-
-
Save markdekuijer/91ae7162400b2c1846a3858af06fa4e3 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Sequence : MonoBehaviour | |
{ | |
public BuildSequenceData BuildData => buildData; | |
public Sprite SequenceExplainer => sequenceExplainer; | |
public Action OnSequenceComplete; | |
[SerializeField] private Sprite sequenceExplainer; | |
[SerializeField] private BuildSequenceData buildData; | |
[SerializeField] private GameObject screwSet; | |
private TaskSequence[] taskSequences; | |
private int currentCompletedSequences; | |
public void StartLoadSequence() | |
{ | |
screwSet.transform.position = new Vector3(2.59f, 0.761f, 0.324f); | |
taskSequences = GetComponentsInChildren<TaskSequence>(); | |
foreach (TaskSequence tasks in taskSequences) | |
{ | |
tasks.OnCompleted += TaskSequenceComplete; | |
tasks.LoadSequence(); | |
} | |
} | |
private void TaskSequenceComplete(TaskSequence completedSequence) | |
{ | |
currentCompletedSequences++; | |
completedSequence.OnCompleted -= TaskSequenceComplete; | |
if (currentCompletedSequences >= taskSequences.Length) | |
{ | |
OnSequenceComplete?.Invoke(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment