/// <summary> /// Implement IUpdateable to gather input for this player controller /// </summary> /// <param name="deltaTime"></param> public void Update(float deltaTime) { if (Input.GetKeyUp(KeyCode.Space)) { Debug.Log(Paperdoll.ToString()); } // equip different weapons if (Input.GetKeyUp(KeyCode.Alpha1)) { Framework.PushCommand(new PlayerEquipItemRequestCmd <WeaponItem>(PaperdollSlot.Weapon, new WeaponItem(1, "lvl 1 sword"))); } if (Input.GetKeyUp(KeyCode.Alpha2)) { Framework.PushCommand(new PlayerEquipItemRequestCmd <WeaponItem>(PaperdollSlot.Weapon, new WeaponItem(10, "lvl 10 sword"))); } // try to equip an armor in the weapon slot if (Input.GetKeyUp(KeyCode.Alpha3)) { Framework.PushCommand(new PlayerEquipItemRequestCmd <ArmorItem>(PaperdollSlot.Weapon, new ArmorItem(20, "lvl 20 armor"))); } // try to equip a weapon in an armor slot if (Input.GetKeyUp(KeyCode.Alpha4)) { Framework.PushCommand(new PlayerEquipItemRequestCmd <WeaponItem>(PaperdollSlot.Head, new WeaponItem(50, "lvl 50 sword"))); } }
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 init() { itemText = GameObject.Find("ItemNameText").GetComponent <Text>(); previewsRoot = GameObject.Find("PreviewsRoot"); DBInst.loadOrCallback((d) => db = d); mainPaperdoll = GameObject.Find("MainPaperdoll").GetComponent <Paperdoll>(); ourPreview = new GameObject(); ourPreview.transform.parent = previewsRoot.transform; EventTrigger trigger = this.gameObject.AddComponent <EventTrigger>(); EventTrigger.Entry entry = new EventTrigger.Entry(); entry.eventID = EventTriggerType.PointerDown; entry.callback.AddListener((data) => { itemClicked(); }); trigger.triggers.Add(entry); EventTrigger.Entry eentry = new EventTrigger.Entry(); eentry.eventID = EventTriggerType.PointerEnter; eentry.callback.AddListener((data) => { itemEntered(); }); trigger.triggers.Add(eentry); }
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)); }
/// <summary> /// Default constructor. /// </summary> /// <param name="serial"></param> public Mobile(Serial serial) : base(serial) { Paperdoll = Paperdoll.GetPaperdoll(this); }