예제 #1
0
    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;
        }
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
        private void updateRaceGender()
        {
            if (state != ClassState.UPDATE)
            {
                Debug.LogError("Cannot update race/gender without being update mode");
                return;
            }


            if (refModel != null)
            {
                GameObject.Destroy(refModel);
            }
            if (costumeParts != null)
            {
                GameObject.Destroy(costumeParts);
            }

            // defines the base model
            string nif = string.Format("{0}_refbare.nif", getBaseModel());
            string kfm = string.Format("{0}.kfm", getBaseModel());
            string kfb = string.Format("{0}.kfb", getKFBBase());

            if (!"".Equals(kfbOverride))
            {
                kfb = kfbOverride;
            }


            animationNif = this.gameObject.GetComponent <AnimatedNif>();
            if (animationNif == null)
            {
                animationNif = this.gameObject.AddComponent <AnimatedNif>();
            }
            animationNif.setParams(AssetDatabaseInst.DB, nif, kfm, kfb);

            NIFFile    file = NIFLoader.getNIF(nif);
            GameObject go   = NIFLoader.loadNIF(file, nif, true);

            go.transform.parent        = this.transform;
            go.transform.localPosition = Vector3.zero;
            go.transform.localRotation = Quaternion.identity;
            refModel = go;


            if (!"".Equals(animOverride))
            {
                animationNif.setActiveAnimation(animOverride);
            }
            else
            {
                string animation = string.Format("{0}_{1}_idle", getBaseModel(), getAnimationSet());
                try
                {
                    animationNif.setActiveAnimation(animation);
                }
                catch (Exception ex)
                {
                    Debug.LogError("Unable to load animation:" + animation);
                }
            }
            animationNif.setSkeletonRoot(refModel);

            costumeParts = new GameObject("CostumeParts");
            costumeParts.transform.parent = refModel.transform;
        }