| | 1 | | using System.Collections; |
| | 2 | | using UnityEngine; |
| | 3 | |
|
| | 4 | | namespace DCL.Tutorial |
| | 5 | | { |
| | 6 | | /// <summary> |
| | 7 | | /// Class that represents the onboarding tutorial step related to how to walk with the avatar. |
| | 8 | | /// </summary> |
| | 9 | | public class TutorialStep_AvatarWalk : TutorialStep |
| | 10 | | { |
| | 11 | | [SerializeField] AudioEvent audioEventSuccess; |
| | 12 | | [SerializeField] InputAction_Measurable playerXAxisInpuAction; |
| | 13 | | [SerializeField] InputAction_Measurable playerYAxisInputAction; |
| | 14 | | [SerializeField] InputAction_Hold playerWalkInputAction; |
| 0 | 15 | | [SerializeField] float minRunningTime = 2f; |
| | 16 | |
|
| | 17 | | private float timeRunning = 0f; |
| | 18 | |
|
| | 19 | | private void Update() |
| | 20 | | { |
| 0 | 21 | | if ((playerXAxisInpuAction.GetValue() != 0f || playerYAxisInputAction.GetValue() != 0f) && |
| | 22 | | playerWalkInputAction.isOn && |
| | 23 | | mainSection.activeSelf) |
| 0 | 24 | | timeRunning += Time.deltaTime; |
| 0 | 25 | | } |
| | 26 | |
|
| | 27 | | public override IEnumerator OnStepExecute() |
| | 28 | | { |
| 0 | 29 | | yield return new WaitUntil(() => timeRunning >= minRunningTime); |
| 0 | 30 | | audioEventSuccess.Play(true); |
| 0 | 31 | | } |
| | 32 | | } |
| | 33 | | } |