void handleMount() { if (mount == null) { int key = ProgramSettings.get("MOUNT_KEY", 1445235995); // dragon mount default string anim = ProgramSettings.get("MOUNT_ANIM", "mount_dragon_jump_cycle"); float speed = ProgramSettings.get("MOUNT_ANIM_SPEED", 0.02f); mount = AnimatedModelLoader.loadNIF(key); AnimatedNif animNif = mount.GetComponent <AnimatedNif>(); animNif.animSpeed = speed; animNif.setSkeletonRoot(mount); animNif.setActiveAnimation(anim); //mount.transform.parent = mcamera.transform; mount.transform.position = this.mcamera.transform.position; mount.transform.rotation = this.mcamera.transform.rotation; // human_female_mount_dragon_jump_cycle.kf GameObject character = new GameObject(); Paperdoll mainPaperdoll = character.AddComponent <Paperdoll>(); mainPaperdoll.animOverride = anim; mainPaperdoll.kfbOverride = "human_female_mount.kfb"; mainPaperdoll.setGender("female"); mainPaperdoll.setRace("human"); //mainPaperdoll.GetComponent<AnimatedNif>().animSpeed = 0.02f; mainPaperdoll.animSpeed = speed; character.transform.parent = mount.transform; character.transform.localPosition = new Vector3(0, 0, 0); character.transform.localRotation = Quaternion.identity; mainPaperdoll.transform.localRotation = Quaternion.identity; mainPaperdoll.setAppearenceSet(-57952362); this.mcamera.GetComponent <cam.camera_movement>().enabled = false; mount_movement mm = mount.AddComponent <mount_movement>(); mm.source = mount; this.mcamera.GetComponent <Mount_Camera>().enabled = true; this.mcamera.GetComponent <Mount_Camera>().target = mount.transform; } else { DestroyChildren(mount.transform); GameObject.Destroy(mount); mount = null; this.mcamera.GetComponent <cam.camera_movement>().enabled = true; this.mcamera.GetComponent <Mount_Camera>().enabled = false; } }
private void updateAvatar() { if (character == null) { character = new GameObject(); } character.SetActive(true); mainPaperdoll = character.GetComponent <Paperdoll>(); if (mainPaperdoll == null) { mainPaperdoll = character.AddComponent <Paperdoll>(); } KFAnimation kf = animationNif.getActiveAnimation(); string animString = kf.sequencename; if (kf.sequencename.StartsWith("mount")) { animString = kf.sequencename; } else { if (kf.sequencename.Contains("mount_")) { animString = kf.sequencename.Substring(kf.sequencename.IndexOf("mount")); } } Debug.Log("setting avatar animation to:" + animString); mainPaperdoll.animOverride = animString; mainPaperdoll.setKFBPostFix("mount"); mainPaperdoll.setGender("male"); mainPaperdoll.setRace("human"); mainPaperdoll.animSpeed = this.animationNif.animSpeed; character.transform.parent = this.nifmodel.transform; character.transform.localPosition = new Vector3(0, 0, 0); character.transform.localRotation = Quaternion.identity; mainPaperdoll.transform.localRotation = Quaternion.identity; //mainPaperdoll.setAppearenceSet(1044454339); int key = ProgramSettings.get("MOUNT_AVATAR_KEY", 736798136); // mainPaperdoll.setAppearenceSet(key); mainPaperdoll.zeroFrame(); this.animationNif.zeroFrame(); }
public void updateRaceGender() { raceString = raceDropdown.options[raceDropdown.value].text; genderString = genderDropdown.options[genderDropdown.value].text; paperDoll.setGender(genderString); paperDoll.setRace(raceString); //paperDoll.updateRaceGender(); ClothingItemRenderer[] renderers = panelUpdater.getPanelRenderers(); foreach (ClothingItemRenderer r in renderers) { if (r.previewPaperdoll != null) { r.previewPaperdoll.setGender(genderString); r.previewPaperdoll.setRace(raceString); r.refresh(); } } // reapply the costume changeAppearance(); }
public void setItem(ClothingItem item, Paperdoll mainDoll) { Debug.Log("set item [" + item + "] and copy others from mainDoll", this.gameObject); this.item = item; ourPreview.transform.Clear(); if (previewPaperdoll == null) { previewPaperdoll = ourPreview.AddComponent <Paperdoll>(); } ourPreview.name = "PaperDoll" + previewIndex; //GameObject.Destroy(previewPaperdoll); previewPaperdoll.setGender(mainPaperdoll.getGenderString()); previewPaperdoll.setRace(mainPaperdoll.getRaceString()); // start isn't called until the next "update" so we need to start it manually string nifstr = Path.GetFileName(item.nifRef.getNif(1, 0)); ourPreview.name = item.name; Debug.Log("copy appearence from mainDoll", this.gameObject); previewPaperdoll.copy(mainDoll); previewPaperdoll.setGearSlotKey(item.allowedSlots.First(), item.key); SetLayerRecursively(ourPreview, LayerMask.NameToLayer("Preview" + previewIndex)); }