/// <summary> /// Get animations, will block if not ready /// </summary> /// <returns></returns> public List <KFAnimation> getAnimations() { checkState(); //while (state != ClassState.IDLE) ; if (animationNif != null) { return(animationNif.getAnimations()); } return(new List <KFAnimation>()); }
public void changeNif(string newNifP) { try { Debug.Log("Change nif:" + newNifP); string newNif = newNifP; if (newNifP.Contains(":")) { newNif = newNifP.Split(':')[1]; } Model animNifModel = nifDictionary[newNif]; AnimatedNif animNif = gameObject.GetComponent <AnimatedNif>(); if (animNif == null) { animNif = gameObject.AddComponent <AnimatedNif>(); } animNif.setParams(adb, animNifModel.nifFile, animNifModel.kfmFile, animNifModel.kfbFile); this.mount = animNifModel.mount; if (nifmodel != null) { GameObject.DestroyImmediate(nifmodel); } Debug.Log("load nif"); nifmodel = NIFLoader.loadNIF(animNif.nif, true); nifmodel.transform.parent = root.transform; Debug.Log("set anims dropdown"); this.animationDropdown.ClearOptions(); List <String> anims = new List <String>(); foreach (KFAnimation ani in animNif.getAnimations()) { //Debug.Log("Found anim [" + ani.id + "]:" + ani.sequenceFilename + ":" + ani.sequencename ); anims.Add(ani.sequencename); } anims.Sort(); Debug.Log("set skel root"); animNif.setSkeletonRoot(nifmodel); animationNif = animNif; Debug.Log("set active anim"); animationNif.setActiveAnimation(animationNif.getIdleAnimIndex()); this.animationDropdown.AddOptions(anims); Debug.Log("DONE Change nif:" + newNifP); } catch (Exception ex) { Debug.LogError(ex); } }