/// <summary> /// Load a UMA recipe and additional recipes into the avatar. /// </summary> /// <param name="umaRecipe">UMA recipe.</param> /// <param name="umaAdditionalRecipes">Additional recipes.</param> public virtual void Load(UMARecipeBase umaRecipe, params UMARecipeBase[] umaAdditionalRecipes) { if (umaRecipe == null) { return; } if (umaData == null) { Initialize(); } Profiler.BeginSample("Load"); this.umaRecipe = umaRecipe; umaRecipe.Load(umaData.umaRecipe, context); umaData.AddAdditionalRecipes(umaAdditionalRecipes, context); if (umaRace != umaData.umaRecipe.raceData) { UpdateNewRace(); } else { UpdateSameRace(); } Profiler.EndSample(); }
void Initialize() { UMAInstance(); gameObject = new GameObject(objectName); UpdateVec(); umaContext = UMAContext.FindInstance(); UMAGenerator generator = umaContext.umaGenerator; umaDynamicAvatar = gameObject.AddComponent <UMADynamicAvatar>(); umaDynamicAvatar.Initialize(); UMAData umaData = umaDynamicAvatar.umaData; umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; UMATextRecipe recipe = UMATextRecipe.CreateInstance <UMATextRecipe>(); recipe.Load(umaData.umaRecipe, umaContext); umaDynamicAvatar.umaRecipe = recipe; umaData.AddAdditionalRecipes(new UMARecipeBase[] { umaContext.umaTextRecipe }, umaContext); umaData.OnCharacterCreated += CharacterCreated; umaData.OnCharacterUpdated += CharacterUpdated; umaData.OnCharacterDestroyed += CharacterDestroyed; if (isExpress) { expressionPlayer = gameObject.AddComponent <UMAExpressionPlayer>(); expressionPlayer.overrideMecanimEyes = true; expressionPlayer.overrideMecanimHead = true; expressionPlayer.overrideMecanimJaw = true; expressionPlayer.overrideMecanimNeck = true; } umaData.umaRecipe.slotDataList = new SlotData[100]; UMADnaHumanoid umaDna = new UMADnaHumanoid(); UMADnaTutorial umaTutorialDNA = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDna); umaData.umaRecipe.AddDna(umaTutorialDNA); ICharacterSlotOverly characterSlotOverlay = new CharacterSlotOverly(umaDynamicAvatar); characterAnim = new CharacterAnim(umaDynamicAvatar); //characterDna = new CharacterDna(umaDna, umaData, characterAnim, characterData); characterBase = new CharacterBase(resType, characterSlotOverlay, umaData, umaDynamicAvatar, characterData); characterCloth = new CharacterCloth(resType, characterData, characterSlotOverlay, this, characterBase); }
private void AddAdditionalSlots() { umaData.AddAdditionalRecipes(additionalRecipes, UMAContext.FindInstance()); }
private void AddAdditionalSlots() { umaData.AddAdditionalRecipes(additionalRecipes, UMAContextBase.Instance); }