45 lines
1.3 KiB
C#
45 lines
1.3 KiB
C#
using System.Collections;
|
|
using UnityEngine;
|
|
|
|
public class MannequinHandsMovementExtension : MonoBehaviour
|
|
{
|
|
public float secondsToWaitForLeftHandEvent;
|
|
public float secondsToWaitForRightHandEvent;
|
|
|
|
private Coroutine leftHandDoEventAfterSeconds;
|
|
private Coroutine rightHandDoEventAfterSeconds;
|
|
|
|
[SerializeField] private EventTrigger leftHandEventTrigger;
|
|
[SerializeField] private EventTrigger rightHandEventTrigger;
|
|
|
|
public void LeftHandDoEvent()
|
|
{
|
|
if (leftHandDoEventAfterSeconds != null)
|
|
{
|
|
leftHandDoEventAfterSeconds = StartCoroutine(LeftHandDoEventAfterSeconds());
|
|
}
|
|
}
|
|
|
|
public void RightHandDoEvent()
|
|
{
|
|
if (rightHandDoEventAfterSeconds != null)
|
|
{
|
|
rightHandDoEventAfterSeconds = StartCoroutine(RightHandDoEventAfterSeconds());
|
|
}
|
|
}
|
|
|
|
IEnumerator LeftHandDoEventAfterSeconds()
|
|
{
|
|
yield return new WaitForSeconds(secondsToWaitForLeftHandEvent);
|
|
leftHandEventTrigger.Invoke();
|
|
leftHandDoEventAfterSeconds = null;
|
|
}
|
|
|
|
IEnumerator RightHandDoEventAfterSeconds()
|
|
{
|
|
yield return new WaitForSeconds(secondsToWaitForRightHandEvent);
|
|
rightHandEventTrigger.Invoke();
|
|
rightHandDoEventAfterSeconds = null;
|
|
}
|
|
}
|