Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEditor;
- using UnityEngine;
- namespace AC
- {
- public class ActionPlayCharacterGesture : Action
- {
- public int AssociatedSpeechID;
- public string Clip;
- public int MecanimLayer;
- public float Delay;
- public override ActionCategory Category { get { return ActionCategory.Character; } }
- public override string Title { get { return "Play Gesture"; } }
- public override string Description { get { return "Plays gesture animation."; } }
- override public float Run()
- {
- CoroutineController.Start(Gesture(AssociatedSpeechID, Clip, MecanimLayer, Delay));
- return 0;
- }
- IEnumerator Gesture(int associatedSpeechID, string clip, int mecanimLayer, float delay)
- {
- yield return new WaitForSeconds(delay);
- Speech speech = KickStarter.dialog.GetLiveSpeechWithID(associatedSpeechID);
- if (speech is null) yield break;
- speech.speaker.GetAnimator().Play(clip, mecanimLayer);
- }
- #if UNITY_EDITOR
- override public void ShowGUI(List<ActionParameter> parameters)
- {
- AssociatedSpeechID = EditorGUILayout.IntField("Associated Speech ID:", AssociatedSpeechID);
- Clip = EditorGUILayout.TextField("Clip:", Clip);
- MecanimLayer = EditorGUILayout.IntField("Mecanim Layer:", MecanimLayer);
- Delay = EditorGUILayout.FloatField("Delay:", Delay);
- }
- #endif
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement