string Instype; //socket message type // Start is called before the first frame update void Start() { salsa = (Salsa)GameObject.Find("biaoqing12").GetComponent <Salsa>(); animator = salsa.GetComponent <Animator>(); instructionQueue = new Queue(); UserGameRecords = new Queue(); VHgameQueue = new Queue(); VHGameRecords = new Queue(); //start socket connection startClient(); animator.speed = 2F; }
//load the audioClip to be displayed by the salsa lip-sync plugin void setAudioClip(string audioFile) { var audSrc = salsa.GetComponent <AudioSource>(); var audioClip = Resources.Load <AudioClip>(audioFile); if (audioClip == null) { Debug.Log("failed to load."); } else { audSrc.clip = audioClip; audSrc.playOnAwake = true; audSrc.loop = false; salsa.audioSrc = audSrc; salsa.audioSrc.Play(); } }
// OnStateEnter is called when a transition starts and the state machine starts to evaluate this state //override public void OnStateEnter(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) //{ // //} // OnStateUpdate is called on each Update frame between OnStateEnter and OnStateExit callbacks //override public void OnStateUpdate(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) //{ // //} // OnStateExit is called when a transition ends and the state machine finishes evaluating this state override public void OnStateExit(Animator animator, AnimatorStateInfo stateInfo, int layerIndex) { salsa = (Salsa)GameObject.Find("biaoqing12").GetComponent <Salsa>(); //access the VH model animator = salsa.GetComponent <Animator>(); //access the animator animator.SetBool("goodbye", false); //set the animation state flag to false after animation finishes }