public override void SetEquipItems(IList <CharacterItem> equipItems) { tempEquipItems = equipItems; if (!IsUmaCharacterCreated) { return; } ClearObjectsAndSlots(equipItemUsedSlots, equipItemObjects); if (CacheUmaAvatar.activeRace == null || CacheUmaAvatar.activeRace.racedata == null || equipItems == null) { return; } string raceName = CacheUmaAvatar.activeRace.racedata.raceName; Item tempEquipmentItem; UMATextRecipe[] receipes; BaseEquipmentEntity tempEquipmentEntity; foreach (CharacterItem equipItem in equipItems) { tempEquipmentItem = equipItem.GetEquipmentItem(); if (tempEquipmentItem == null) { continue; } SetEquipmentObject(equipItemObjects, tempEquipmentItem.equipmentModels, equipItem.level, out tempEquipmentEntity); if (!tempEquipmentItem.CacheUmaRecipeSlot.TryGetValue(raceName, out receipes)) { continue; } SetSlot(equipItemUsedSlots, receipes); } // Update avatar CacheUmaAvatar.BuildCharacter(true); CacheUmaAvatar.ForceUpdate(true, true, true); }
public override void SetEquipWeapons(EquipWeapons equipWeapons) { tempEquipWeapons = equipWeapons; SetClipBasedOnWeapon(equipWeapons); if (!IsUmaCharacterCreated) { return; } ClearObjectsAndSlots(equipWeaponUsedSlots, equipWeaponObjects); if (CacheUmaAvatar.activeRace == null || CacheUmaAvatar.activeRace.racedata == null || equipWeapons == null) { return; } string raceName = CacheUmaAvatar.activeRace.racedata.raceName; Item tempEquipmentItem; UMATextRecipe[] receipes; // Setup right hand weapon if (equipWeapons.rightHand != null) { tempEquipmentItem = equipWeapons.rightHand.GetWeaponItem(); if (tempEquipmentItem != null) { SetEquipmentObject(equipWeaponObjects, tempEquipmentItem.equipmentModels, equipWeapons.rightHand.level, out rightHandEquipmentEntity); if (tempEquipmentItem.CacheUmaRecipeSlot.TryGetValue(raceName, out receipes)) { SetSlot(equipWeaponUsedSlots, receipes); } } } // Setup left hand weapon if (equipWeapons.leftHand != null) { // Weapon tempEquipmentItem = equipWeapons.leftHand.GetWeaponItem(); if (tempEquipmentItem != null) { SetEquipmentObject(equipWeaponObjects, tempEquipmentItem.subEquipmentModels, equipWeapons.leftHand.level, out leftHandEquipmentEntity); if (tempEquipmentItem.CacheUmaRecipeSlot.TryGetValue(raceName, out receipes)) { SetSlot(equipWeaponUsedSlots, receipes); } } // Shield tempEquipmentItem = equipWeapons.leftHand.GetShieldItem(); if (tempEquipmentItem != null) { SetEquipmentObject(equipWeaponObjects, tempEquipmentItem.equipmentModels, equipWeapons.leftHand.level, out leftHandEquipmentEntity); if (tempEquipmentItem.CacheUmaRecipeSlot.TryGetValue(raceName, out receipes)) { SetSlot(equipWeaponUsedSlots, receipes); } } } // Update avatar CacheUmaAvatar.BuildCharacter(true); CacheUmaAvatar.ForceUpdate(true, true, true); }
IEnumerator ApplyUmaAvatarRoutine(UmaAvatarData avatarData) { int i; UmaRace race = CurrentGameInstance.UmaRaces[avatarData.raceIndex]; UmaRaceGender gender = race.genders[avatarData.genderIndex]; CacheUmaAvatar.ChangeRace(gender.raceData.raceName); yield return(null); // Set character hair, beard, eyebrows (or other things up to your settings) if (avatarData.slots != null) { Dictionary <string, List <UMATextRecipe> > recipes = CacheUmaAvatar.AvailableRecipes; string slotName; for (i = 0; i < gender.customizableSlots.Length; ++i) { if (i >= avatarData.slots.Length) { break; } slotName = gender.customizableSlots[i].name; CacheUmaAvatar.SetSlot(recipes[slotName][avatarData.slots[i]]); } } // Set skin color, eyes color, hair color (or other things up to your settings) if (avatarData.colors != null) { SharedColorTable colorTable; for (i = 0; i < race.colorTables.Length; ++i) { if (i >= avatarData.colors.Length) { break; } colorTable = race.colorTables[i]; CacheUmaAvatar.SetColor(colorTable.sharedColorName, colorTable.colors[avatarData.colors[i]]); } } // Set equip items if it is already set if (tempEquipWeapons != null) { SetEquipWeapons(tempEquipWeapons); } if (tempEquipItems != null) { SetEquipItems(tempEquipItems); } // Update avatar CacheUmaAvatar.BuildCharacter(true); CacheUmaAvatar.ForceUpdate(true, true, true); yield return(null); // Set character dna if (avatarData.dnas != null) { Dictionary <string, DnaSetter> dnas = null; while (dnas == null || dnas.Count == 0) { dnas = CacheUmaAvatar.GetDNA(); yield return(null); } List <string> dnaNames = new List <string>(dnas.Keys); dnaNames.Sort(); string dnaName; for (i = 0; i < dnaNames.Count; ++i) { if (i >= avatarData.dnas.Length) { break; } dnaName = dnaNames[i]; dnas[dnaName].Set(avatarData.dnas[i] * 0.01f); } } // Update avatar after set dna CacheUmaAvatar.ForceUpdate(true, false, false); }