void GenerateUMA() { // Create a new game object and add UMA components to it GameObject GO = new GameObject("MyUMA"); umaDynamicAvatar = GO.AddComponent <UMADynamicAvatar>(); // Initialise Avatar and grab a reference to it's data component umaDynamicAvatar.Initialize(); umaData = umaDynamicAvatar.umaData; // Attach our generator umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; // Set up slot Array umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots]; // Set up our Morph reference umaDna = new UMADnaHumanoid(); umaTutorialDNA = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDna); umaData.umaRecipe.AddDna(umaTutorialDNA); // Grab a reference to our recipe // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale // >>> This is whee the fun will happen according to Secret Anorak <<<< CreateMale(); // Generate Our UMA umaDynamicAvatar.UpdateNewRace(); }
void GenerateUMA() { // Generate new GameObject and add UMA components to it GameObject GO = new GameObject("NPC"); umaDynamicAvatar = GO.AddComponent <UMADynamicAvatar> (); // Initialise Avatar and grab a reference to it's data component umaDynamicAvatar.Initialize(); umaData = umaDynamicAvatar.umaData; // Attach our generator umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; // Set up slot Array umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots]; // Set up our Morph references umaDna = new UMADnaHumanoid(); umaData.umaRecipe.AddDna(umaDna); GenerateNPC(); umaDynamicAvatar.animationController = animController; // Generate our UMA umaDynamicAvatar.UpdateNewRace(); GO.transform.parent = this.gameObject.transform; GO.transform.localPosition = Vector3.zero; GO.transform.localRotation = Quaternion.identity; }
// Set the camera target and viewport private void SetCamera(bool show) { if (show) { DnaPanel.SetActive(true); DnaHide.gameObject.SetActive(true); #if UNITY_5 && !UNITY_5_1 && !UNITY_5_0 // really Unity? Yes we change the value and set it back to trigger a ui recalculation... // because setting the damn game object active doesn't do that! var rt = DnaPanel.GetComponent <RectTransform>(); var pos = rt.offsetMin; rt.offsetMin = new Vector2(pos.x + 1, pos.y); rt.offsetMin = pos; #endif } else { if (cameraTrack != null) { cameraTrack.target = baseTarget; } if (orbitor != null) { orbitor.target = baseTarget; } DnaPanel.SetActive(false); DnaHide.gameObject.SetActive(false); umaData = null; umaDna = null; umaTutorialDna = null; } }
void GeneratUMA() { //Add UMA Components to GameObject GO GameObject GO = new GameObject("MyUMA"); umaDynamicAvatar = GO.AddComponent <UMADynamicAvatar> (); //Initialise avatar and grab a reference to it's data component umaDynamicAvatar.Initialize(); umaData = umaDynamicAvatar.umaData; //Attach our generator umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; //Setup slot array umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots]; //Setup Morph References umaDna = new UMADnaHumanoid(); umaTutorialDna = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDna); umaData.umaRecipe.AddDna(umaTutorialDna); //Make UMA CreateMale(); umaDynamicAvatar.animationController = animController; umaDynamicAvatar.UpdateNewRace(); //Setze Player als Parent GO.transform.parent = this.gameObject.transform; GO.transform.localPosition = Vector3.zero; GO.transform.localRotation = Quaternion.identity; }
public void generateDNA(UMADnaHumanoid dna) { if (dna == null) { return; } GD.Print("[UMA] Transform Mesh by DNA"); adjustBones(bones); if (isMale) { var gen = new UMA.DNA.HumanMaleConverter(); gen.poses = (List <GodotBindPose>)DeepClone(bones); gen.Adjust(dna); adjustBones(gen.poses); } else { var gen = new UMA.DNA.HumanFemaleConverter(); gen.poses = (List <GodotBindPose>)DeepClone(bones); gen.Adjust(dna); adjustBones(gen.poses); } }
void GenerateUMA() { GameObject myUMA = new GameObject("MyUMA"); avatar = myUMA.AddComponent <UMADynamicAvatar>(); avatar.Initialize(); umaData = avatar.umaData; avatar.umaGenerator = generator; umaData.umaGenerator = generator; umaData.umaRecipe = new UMAData.UMARecipe(); umaData.umaRecipe.slotDataList = new SlotData[NUM_SLOTS]; umaDna = new UMADnaHumanoid(); umaTutorialDna = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDna); umaData.umaRecipe.AddDna(umaTutorialDna); CreateMale(); avatar.animationController = animController; avatar.UpdateNewRace(); myUMA.transform.parent = this.gameObject.transform; myUMA.transform.localPosition = Vector3.zero; myUMA.transform.localRotation = Quaternion.identity; }
public void Update() { if (umaData == null) { umaData = this.GetComponent <UMADynamicAvatar> ().umaData; umaDNA = umaData.GetDna <UMADnaHumanoid> (); } }
public static string SaveInstance(UMADnaHumanoid instance) { #if !StripLitJson return(LitJson.JsonMapper.ToJson(UMADnaHumanoid_Byte.FromDna(instance))); #else return(null); #endif }
public void Initialize(UMADiAvatar.Factory avatarGOFactory, UMADnaHumanoid dna, UMADnaTutorial tutorial) { this.avatarGOFactory = avatarGOFactory; this.umaDna = dna; this.umaTutorialDna = tutorial; GenerateUMA(); }
public static string[] GetNames(System.Type dnaType) { if (dnaType == typeof(UMADnaHumanoid)) { return(UMADnaHumanoid.GetNames()); } return(new string[0]); }
public static System.String SaveInstance(UMADnaBase instance) { System.Type dnaType = instance.GetType(); if (dnaType == typeof(UMADnaHumanoid)) { return(UMADnaHumanoid.SaveInstance(instance as UMADnaHumanoid)); } return(null); }
public static UMADna LoadInstance(System.Type dnaType, System.String data) { if (dnaType == typeof(UMADnaHumanoid)) { return(UMADnaHumanoid.LoadInstance(data)); } return(null); }
void myColliderUpdateMethod(UMAData umaData) { CapsuleCollider tempCollider = umaData.umaRoot.gameObject.GetComponent("CapsuleCollider") as CapsuleCollider; if (tempCollider) { UMADnaHumanoid umaDna = umaData.umaRecipe.GetDna <UMADnaHumanoid>(); tempCollider.height = (umaDna.height + 0.5f) * 2 + 0.1f; tempCollider.center = new Vector3(0, tempCollider.height * 0.5f - 0.04f, 0); } }
public override void OnEnter() { umaData = ((GameObject)gameObject.Value).GetComponent <UMAData> (); umaDna = umaData.GetDna <UMADnaHumanoid> (); info = umaDna.GetType().GetField(dna.ToString()); store.Value = (float)info.GetValue(umaDna); if (!everyFrame) { Finish(); } }
private void GetUMAData(GameObject myUma) { UMAData tempUMA = myUma.GetComponent <UMAData>(); if (tempUMA) { umaData = tempUMA; umaDna = umaData.umaRecipe.GetDna <UMADnaHumanoid>(); ReceiveValues(); } }
public static UMADnaHumanoid_Byte FromDna(UMADnaHumanoid dna) { var res = new UMADnaHumanoid_Byte(); res.height = (System.Byte)(dna.height * 255f + 0.5f); res.headSize = (System.Byte)(dna.headSize * 255f + 0.5f); res.headWidth = (System.Byte)(dna.headWidth * 255f + 0.5f); res.neckThickness = (System.Byte)(dna.neckThickness * 255f + 0.5f); res.armLength = (System.Byte)(dna.armLength * 255f + 0.5f); res.forearmLength = (System.Byte)(dna.forearmLength * 255f + 0.5f); res.armWidth = (System.Byte)(dna.armWidth * 255f + 0.5f); res.forearmWidth = (System.Byte)(dna.forearmWidth * 255f + 0.5f); res.handsSize = (System.Byte)(dna.handsSize * 255f + 0.5f); res.feetSize = (System.Byte)(dna.feetSize * 255f + 0.5f); res.legSeparation = (System.Byte)(dna.legSeparation * 255f + 0.5f); res.upperMuscle = (System.Byte)(dna.upperMuscle * 255f + 0.5f); res.lowerMuscle = (System.Byte)(dna.lowerMuscle * 255f + 0.5f); res.upperWeight = (System.Byte)(dna.upperWeight * 255f + 0.5f); res.lowerWeight = (System.Byte)(dna.lowerWeight * 255f + 0.5f); res.legsSize = (System.Byte)(dna.legsSize * 255f + 0.5f); res.belly = (System.Byte)(dna.belly * 255f + 0.5f); res.waist = (System.Byte)(dna.waist * 255f + 0.5f); res.gluteusSize = (System.Byte)(dna.gluteusSize * 255f + 0.5f); res.earsSize = (System.Byte)(dna.earsSize * 255f + 0.5f); res.earsPosition = (System.Byte)(dna.earsPosition * 255f + 0.5f); res.earsRotation = (System.Byte)(dna.earsRotation * 255f + 0.5f); res.noseSize = (System.Byte)(dna.noseSize * 255f + 0.5f); res.noseCurve = (System.Byte)(dna.noseCurve * 255f + 0.5f); res.noseWidth = (System.Byte)(dna.noseWidth * 255f + 0.5f); res.noseInclination = (System.Byte)(dna.noseInclination * 255f + 0.5f); res.nosePosition = (System.Byte)(dna.nosePosition * 255f + 0.5f); res.nosePronounced = (System.Byte)(dna.nosePronounced * 255f + 0.5f); res.noseFlatten = (System.Byte)(dna.noseFlatten * 255f + 0.5f); res.chinSize = (System.Byte)(dna.chinSize * 255f + 0.5f); res.chinPronounced = (System.Byte)(dna.chinPronounced * 255f + 0.5f); res.chinPosition = (System.Byte)(dna.chinPosition * 255f + 0.5f); res.mandibleSize = (System.Byte)(dna.mandibleSize * 255f + 0.5f); res.jawsSize = (System.Byte)(dna.jawsSize * 255f + 0.5f); res.jawsPosition = (System.Byte)(dna.jawsPosition * 255f + 0.5f); res.cheekSize = (System.Byte)(dna.cheekSize * 255f + 0.5f); res.cheekPosition = (System.Byte)(dna.cheekPosition * 255f + 0.5f); res.lowCheekPronounced = (System.Byte)(dna.lowCheekPronounced * 255f + 0.5f); res.lowCheekPosition = (System.Byte)(dna.lowCheekPosition * 255f + 0.5f); res.foreheadSize = (System.Byte)(dna.foreheadSize * 255f + 0.5f); res.foreheadPosition = (System.Byte)(dna.foreheadPosition * 255f + 0.5f); res.lipsSize = (System.Byte)(dna.lipsSize * 255f + 0.5f); res.mouthSize = (System.Byte)(dna.mouthSize * 255f + 0.5f); res.eyeRotation = (System.Byte)(dna.eyeRotation * 255f + 0.5f); res.eyeSize = (System.Byte)(dna.eyeSize * 255f + 0.5f); res.breastSize = (System.Byte)(dna.breastSize * 255f + 0.5f); return(res); }
public UMADnaHumanoid ToDna() { var res = new UMADnaHumanoid(); res.height = height * (1f / 255f); res.headSize = headSize * (1f / 255f); res.headWidth = headWidth * (1f / 255f); res.neckThickness = neckThickness * (1f / 255f); res.armLength = armLength * (1f / 255f); res.forearmLength = forearmLength * (1f / 255f); res.armWidth = armWidth * (1f / 255f); res.forearmWidth = forearmWidth * (1f / 255f); res.handsSize = handsSize * (1f / 255f); res.feetSize = feetSize * (1f / 255f); res.legSeparation = legSeparation * (1f / 255f); res.upperMuscle = upperMuscle * (1f / 255f); res.lowerMuscle = lowerMuscle * (1f / 255f); res.upperWeight = upperWeight * (1f / 255f); res.lowerWeight = lowerWeight * (1f / 255f); res.legsSize = legsSize * (1f / 255f); res.belly = belly * (1f / 255f); res.waist = waist * (1f / 255f); res.gluteusSize = gluteusSize * (1f / 255f); res.earsSize = earsSize * (1f / 255f); res.earsPosition = earsPosition * (1f / 255f); res.earsRotation = earsRotation * (1f / 255f); res.noseSize = noseSize * (1f / 255f); res.noseCurve = noseCurve * (1f / 255f); res.noseWidth = noseWidth * (1f / 255f); res.noseInclination = noseInclination * (1f / 255f); res.nosePosition = nosePosition * (1f / 255f); res.nosePronounced = nosePronounced * (1f / 255f); res.noseFlatten = noseFlatten * (1f / 255f); res.chinSize = chinSize * (1f / 255f); res.chinPronounced = chinPronounced * (1f / 255f); res.chinPosition = chinPosition * (1f / 255f); res.mandibleSize = mandibleSize * (1f / 255f); res.jawsSize = jawsSize * (1f / 255f); res.jawsPosition = jawsPosition * (1f / 255f); res.cheekSize = cheekSize * (1f / 255f); res.cheekPosition = cheekPosition * (1f / 255f); res.lowCheekPronounced = lowCheekPronounced * (1f / 255f); res.lowCheekPosition = lowCheekPosition * (1f / 255f); res.foreheadSize = foreheadSize * (1f / 255f); res.foreheadPosition = foreheadPosition * (1f / 255f); res.lipsSize = lipsSize * (1f / 255f); res.mouthSize = mouthSize * (1f / 255f); res.eyeRotation = eyeRotation * (1f / 255f); res.eyeSize = eyeSize * (1f / 255f); res.breastSize = breastSize * (1f / 255f); return(res); }
public void AvatarSetup() { umaDynamicAvatar = umaData.gameObject.GetComponent <UMADynamicAvatar>(); if (cameraTrack) { cameraTrack.target = umaData.umaRoot.transform; } umaDna = umaData.umaRecipe.GetDna <UMADnaHumanoid>(); ReceiveValues(); }
void GenerateUMA() { // Create a new game object and add UMA components to it GameObject GO = new GameObject("MyUMA"); umaDynamicAvatar = GO.AddComponent <UMADynamicAvatar>(); // Initialise Avatar and grab a reference to it's data component umaDynamicAvatar.Initialize(); umaData = umaDynamicAvatar.umaData; //practical guide to uma part 15 uma events https://youtu.be/_k-SZRCvgIk?t=8m20s umaData.OnCharacterCreated += CharacterCreatedCallback; // Attach our generator umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; // Set up slot Array umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots]; // Set up our Morph reference umaDna = new UMADnaHumanoid(); umaTutorialDNA = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDna); umaData.umaRecipe.AddDna(umaTutorialDNA); // Grab a reference to our recipe // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale // >>> This is whee the fun will happen according to Secret Anorak <<<< CreateMale(); // dynamic animation controller umaDynamicAvatar.animationController = animController; // Generate Our UMA umaDynamicAvatar.UpdateNewRace(); // parent the new uma into the host game object GO.transform.parent = this.gameObject.transform; GO.transform.localPosition = Vector3.zero; GO.transform.localRotation = Quaternion.identity; // GO.AddComponent(typeof(Animator)); GO.AddComponent(typeof(UnityEngine.AI.NavMeshAgent)); GO.AddComponent(typeof(Rigidbody)); GO.AddComponent(typeof(CapsuleCollider)); var goCol = GO.GetComponent <CapsuleCollider>(); goCol.center = new Vector3(0f, 0.78f, 0f); goCol.height = 1.7f; goCol.radius = 0.2f; }
void GenerateUMA() { //UMA naming // Check a list of UMA objects. int umaCount = GameObject.FindGameObjectsWithTag("UMA").Length; UMAName = "UMA_" + umaCount.ToString(); // Create a new game object and add UMA components to it GameObject GO = new GameObject("myUMA"); GO.tag = "UMA"; umaDynamicAvatar = GO.AddComponent <UMADynamicAvatar>(); // Initialise Avatar and grab a reference to it's data component umaDynamicAvatar.Initialize(); umaData = umaDynamicAvatar.umaData; //practical guide to uma part 15 uma events https://youtu.be/_k-SZRCvgIk?t=8m20s umaData.OnCharacterCreated += CharacterCreatedCallback; // Attach our generator umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; // Set up slot Array umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots]; // Set up our Morph reference umaDna = new UMADnaHumanoid(); umaTutorialDNA = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDna); umaData.umaRecipe.AddDna(umaTutorialDNA); // Grab a reference to our recipe // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale // >>> This is whee the fun will happen according to Secret Anorak <<<< CreateMale(); // dynamic animation controller umaDynamicAvatar.animationController = animController; // Generate Our UMA umaDynamicAvatar.UpdateNewRace(); // parent the new uma into the host game object GO.transform.parent = this.gameObject.transform; GO.transform.localPosition = Vector3.zero; GO.transform.localRotation = Quaternion.identity; }
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); }
protected virtual void GenerateUMAShapes() { UMADnaHumanoid umaDna = umaData.umaRecipe.GetDna <UMADnaHumanoid>(); if (umaDna == null) { umaDna = new UMADnaHumanoid(); umaData.umaRecipe.AddDna(umaDna); } if (randomDna) { RandomizeShape(umaData); } }
// An avatar has been selected, setup the camera, sliders, retarget the camera, and adjust the viewport // to account for the DNA slider scroll panel public void AvatarSetup() { umaDynamicAvatar = umaData.gameObject.GetComponent <UMADynamicAvatar>(); if (cameraTrack) { cameraTrack.target = umaData.umaRoot.transform; } umaDna = umaData.GetDna <UMADnaHumanoid>(); umaTutorialDna = umaData.GetDna <UMADnaTutorial>(); SetSliders(); SetCamera(true); }
public static UMADnaBase LoadInstance(System.Type dnaType, System.String data) { if (dnaType == typeof(UMADnaHumanoid)) { return(UMADnaHumanoid.LoadInstance(data)); } if (dnaType == typeof(UMADnaTutorial)) { return(UMADnaTutorial.LoadInstance(data)); } if (dnaType == typeof(DynamicUMADna)) { return(DynamicUMADna.LoadInstance(data)); } return(null); }
public static string[] GetNames(System.Type dnaType) { if (dnaType == typeof(UMADnaHumanoid)) { return(UMADnaHumanoid.GetNames()); } if (dnaType == typeof(UMADnaTutorial)) { return(UMADnaTutorial.GetNames()); } if (dnaType == typeof(DynamicUMADna)) { return(DynamicUMADna.GetNames()); } return(new string[0]); }
public override void OnEnter() { umaData = ((GameObject)gameObject.Value).GetComponent <UMAData> (); umaDna = umaData.GetDna <UMADnaHumanoid> (); info = umaDna.GetType().GetField(dna.ToString()); if (!Mathf.Approximately(value.Value, (float)info.GetValue(umaDna))) { info.SetValue(umaDna, value.Value); UpdateUMAShape(); } if (!everyFrame) { Finish(); } }
void GenerateUMA() { // Create a new game object and add UMA components to it GameObject GO = new GameObject("MyUMA"); umaDynamicAvatar = GO.AddComponent <UMADynamicAvatar>(); // Initialise Avatar and grab a reference to it's data component umaDynamicAvatar.Initialize(); umaData = umaDynamicAvatar.umaData; //practical guide to uma part 15 uma events https://youtu.be/_k-SZRCvgIk?t=8m20s umaData.OnCharacterCreated += CharacterCreatedCallback; // Attach our generator umaDynamicAvatar.umaGenerator = generator; umaData.umaGenerator = generator; // Set up slot Array umaData.umaRecipe.slotDataList = new SlotData[numberOfSlots]; // Set up our Morph reference umaDna = new UMADnaHumanoid(); umaTutorialDNA = new UMADnaTutorial(); umaData.umaRecipe.AddDna(umaDna); umaData.umaRecipe.AddDna(umaTutorialDNA); // Grab a reference to our recipe // var umaRecipe = umaDynamicAvatar.umaData.umaRecipe; //moved to subroutine MakeMale // >>> This is where the fun will happen according to Secret Anorak <<<< CreateMale(); // dynamic animation controller umaDynamicAvatar.animationController = animController; // Generate Our UMA umaDynamicAvatar.UpdateNewRace(); }
void InitializeUma() { GameObject go = transform.FindChild("AvatarContainer").gameObject; avatar = go.AddComponent <UMADynamicAvatar> (); avatar.Initialize(); avatar.umaGenerator = generator; avatar.animationController = animController; // TODO make this a server command UMAGeneratorBase.OnUmaAnimatorCreated += heroAnimator.OnUmaAnimatorCreated; avatar.umaData.OnCharacterCreated += OnCharacterCreated; dna = new UMADnaHumanoid(); tutorialDna = new UMADnaTutorial(); data = avatar.umaData; data.umaGenerator = generator; data.umaRecipe.slotDataList = new SlotData[numSlots]; data.umaRecipe.AddDna(dna); data.umaRecipe.AddDna(tutorialDna); ApplyHumanMaleRecipe(); avatar.UpdateNewRace(); }
protected override PlayerModel LoadModel(Player player) { GameObject uma = new GameObject(); var dynamicAvatar = uma.AddComponent <UMADynamicAvatar>(); dynamicAvatar.Initialize(); var umaData = dynamicAvatar.umaData; umaData.umaGenerator = Generator; umaData.umaRecipe.slotDataList = new SlotData[NumberOfSlots]; var dna = new UMADnaHumanoid(); var tutorialDna = new UMADnaTutorial(); umaData.umaRecipe.AddDna(dna); umaData.umaRecipe.AddDna(tutorialDna); CreateMale(umaData); dynamicAvatar.UpdateNewRace(); var coll = uma.AddComponent <CapsuleCollider>(); coll.height = umaData.characterHeight; coll.radius = umaData.characterRadius; coll.center = new Vector3(0, 0.8f, 0); var rigid = uma.AddComponent <Rigidbody>(); rigid.freezeRotation = true; rigid.mass = umaData.characterMass; UMAModel model = player.gameObject.AddComponent <UMAModel>(); model.InternalModel = uma; return(model); }
private static void RandomizeShapeLegacy(UMAData umaData) { UMADnaHumanoid umaDna = umaData.umaRecipe.GetDna <UMADnaHumanoid>(); umaDna.height = Random.Range(0.4f, 0.5f); umaDna.headSize = Random.Range(0.485f, 0.515f); umaDna.headWidth = Random.Range(0.4f, 0.6f); umaDna.neckThickness = Random.Range(0.495f, 0.51f); if (umaData.umaRecipe.raceData.raceName == "HumanMale") { umaDna.handsSize = Random.Range(0.485f, 0.515f); umaDna.feetSize = Random.Range(0.485f, 0.515f); umaDna.legSeparation = Random.Range(0.4f, 0.6f); umaDna.waist = 0.5f; } else { umaDna.handsSize = Random.Range(0.485f, 0.515f); umaDna.feetSize = Random.Range(0.485f, 0.515f); umaDna.legSeparation = Random.Range(0.485f, 0.515f); umaDna.waist = Random.Range(0.3f, 0.8f); } umaDna.armLength = Random.Range(0.485f, 0.515f); umaDna.forearmLength = Random.Range(0.485f, 0.515f); umaDna.armWidth = Random.Range(0.3f, 0.8f); umaDna.forearmWidth = Random.Range(0.3f, 0.8f); umaDna.upperMuscle = Random.Range(0.0f, 1.0f); umaDna.upperWeight = Random.Range(-0.2f, 0.2f) + umaDna.upperMuscle; if (umaDna.upperWeight > 1.0) { umaDna.upperWeight = 1.0f; } if (umaDna.upperWeight < 0.0) { umaDna.upperWeight = 0.0f; } umaDna.lowerMuscle = Random.Range(-0.2f, 0.2f) + umaDna.upperMuscle; if (umaDna.lowerMuscle > 1.0) { umaDna.lowerMuscle = 1.0f; } if (umaDna.lowerMuscle < 0.0) { umaDna.lowerMuscle = 0.0f; } umaDna.lowerWeight = Random.Range(-0.1f, 0.1f) + umaDna.upperWeight; if (umaDna.lowerWeight > 1.0) { umaDna.lowerWeight = 1.0f; } if (umaDna.lowerWeight < 0.0) { umaDna.lowerWeight = 0.0f; } umaDna.belly = umaDna.upperWeight * Random.Range(0.0f, 1.0f); umaDna.legsSize = Random.Range(0.45f, 0.6f); umaDna.gluteusSize = Random.Range(0.4f, 0.6f); umaDna.earsSize = Random.Range(0.3f, 0.8f); umaDna.earsPosition = Random.Range(0.3f, 0.8f); umaDna.earsRotation = Random.Range(0.3f, 0.8f); umaDna.noseSize = Random.Range(0.3f, 0.8f); umaDna.noseCurve = Random.Range(0.3f, 0.8f); umaDna.noseWidth = Random.Range(0.3f, 0.8f); umaDna.noseInclination = Random.Range(0.3f, 0.8f); umaDna.nosePosition = Random.Range(0.3f, 0.8f); umaDna.nosePronounced = Random.Range(0.3f, 0.8f); umaDna.noseFlatten = Random.Range(0.3f, 0.8f); umaDna.chinSize = Random.Range(0.3f, 0.8f); umaDna.chinPronounced = Random.Range(0.3f, 0.8f); umaDna.chinPosition = Random.Range(0.3f, 0.8f); umaDna.mandibleSize = Random.Range(0.45f, 0.52f); umaDna.jawsSize = Random.Range(0.3f, 0.8f); umaDna.jawsPosition = Random.Range(0.3f, 0.8f); umaDna.cheekSize = Random.Range(0.3f, 0.8f); umaDna.cheekPosition = Random.Range(0.3f, 0.8f); umaDna.lowCheekPronounced = Random.Range(0.3f, 0.8f); umaDna.lowCheekPosition = Random.Range(0.3f, 0.8f); umaDna.foreheadSize = Random.Range(0.3f, 0.8f); umaDna.foreheadPosition = Random.Range(0.15f, 0.65f); umaDna.lipsSize = Random.Range(0.3f, 0.8f); umaDna.mouthSize = Random.Range(0.3f, 0.8f); umaDna.eyeRotation = Random.Range(0.3f, 0.8f); umaDna.eyeSize = Random.Range(0.3f, 0.8f); umaDna.breastSize = Random.Range(0.3f, 0.8f); }
public static UMADnaHumanoid_Byte FromDna(UMADnaHumanoid dna) { var res = new UMADnaHumanoid_Byte(); res.height = (System.Byte)(dna.height * 255f+0.5f); res.headSize = (System.Byte)(dna.headSize * 255f+0.5f); res.headWidth = (System.Byte)(dna.headWidth * 255f+0.5f); res.neckThickness = (System.Byte)(dna.neckThickness * 255f+0.5f); res.armLength = (System.Byte)(dna.armLength * 255f+0.5f); res.forearmLength = (System.Byte)(dna.forearmLength * 255f+0.5f); res.armWidth = (System.Byte)(dna.armWidth * 255f+0.5f); res.forearmWidth = (System.Byte)(dna.forearmWidth * 255f+0.5f); res.handsSize = (System.Byte)(dna.handsSize * 255f+0.5f); res.feetSize = (System.Byte)(dna.feetSize * 255f+0.5f); res.legSeparation = (System.Byte)(dna.legSeparation * 255f+0.5f); res.upperMuscle = (System.Byte)(dna.upperMuscle * 255f+0.5f); res.lowerMuscle = (System.Byte)(dna.lowerMuscle * 255f+0.5f); res.upperWeight = (System.Byte)(dna.upperWeight * 255f+0.5f); res.lowerWeight = (System.Byte)(dna.lowerWeight * 255f+0.5f); res.legsSize = (System.Byte)(dna.legsSize * 255f+0.5f); res.belly = (System.Byte)(dna.belly * 255f+0.5f); res.waist = (System.Byte)(dna.waist * 255f+0.5f); res.gluteusSize = (System.Byte)(dna.gluteusSize * 255f+0.5f); res.earsSize = (System.Byte)(dna.earsSize * 255f+0.5f); res.earsPosition = (System.Byte)(dna.earsPosition * 255f+0.5f); res.earsRotation = (System.Byte)(dna.earsRotation * 255f+0.5f); res.noseSize = (System.Byte)(dna.noseSize * 255f+0.5f); res.noseCurve = (System.Byte)(dna.noseCurve * 255f+0.5f); res.noseWidth = (System.Byte)(dna.noseWidth * 255f+0.5f); res.noseInclination = (System.Byte)(dna.noseInclination * 255f+0.5f); res.nosePosition = (System.Byte)(dna.nosePosition * 255f+0.5f); res.nosePronounced = (System.Byte)(dna.nosePronounced * 255f+0.5f); res.noseFlatten = (System.Byte)(dna.noseFlatten * 255f+0.5f); res.chinSize = (System.Byte)(dna.chinSize * 255f+0.5f); res.chinPronounced = (System.Byte)(dna.chinPronounced * 255f+0.5f); res.chinPosition = (System.Byte)(dna.chinPosition * 255f+0.5f); res.mandibleSize = (System.Byte)(dna.mandibleSize * 255f+0.5f); res.jawsSize = (System.Byte)(dna.jawsSize * 255f+0.5f); res.jawsPosition = (System.Byte)(dna.jawsPosition * 255f+0.5f); res.cheekSize = (System.Byte)(dna.cheekSize * 255f+0.5f); res.cheekPosition = (System.Byte)(dna.cheekPosition * 255f+0.5f); res.lowCheekPronounced = (System.Byte)(dna.lowCheekPronounced * 255f+0.5f); res.lowCheekPosition = (System.Byte)(dna.lowCheekPosition * 255f+0.5f); res.foreheadSize = (System.Byte)(dna.foreheadSize * 255f+0.5f); res.foreheadPosition = (System.Byte)(dna.foreheadPosition * 255f+0.5f); res.lipsSize = (System.Byte)(dna.lipsSize * 255f+0.5f); res.mouthSize = (System.Byte)(dna.mouthSize * 255f+0.5f); res.eyeRotation = (System.Byte)(dna.eyeRotation * 255f+0.5f); res.eyeSize = (System.Byte)(dna.eyeSize * 255f+0.5f); res.breastSize = (System.Byte)(dna.breastSize * 255f+0.5f); return res; }
public UMADnaHumanoid ToDna() { var res = new UMADnaHumanoid(); res.height = height * (1f / 255f); res.headSize = headSize * (1f / 255f); res.headWidth = headWidth * (1f / 255f); res.neckThickness = neckThickness * (1f / 255f); res.armLength = armLength * (1f / 255f); res.forearmLength = forearmLength * (1f / 255f); res.armWidth = armWidth * (1f / 255f); res.forearmWidth = forearmWidth * (1f / 255f); res.handsSize = handsSize * (1f / 255f); res.feetSize = feetSize * (1f / 255f); res.legSeparation = legSeparation * (1f / 255f); res.upperMuscle = upperMuscle * (1f / 255f); res.lowerMuscle = lowerMuscle * (1f / 255f); res.upperWeight = upperWeight * (1f / 255f); res.lowerWeight = lowerWeight * (1f / 255f); res.legsSize = legsSize * (1f / 255f); res.belly = belly * (1f / 255f); res.waist = waist * (1f / 255f); res.gluteusSize = gluteusSize * (1f / 255f); res.earsSize = earsSize * (1f / 255f); res.earsPosition = earsPosition * (1f / 255f); res.earsRotation = earsRotation * (1f / 255f); res.noseSize = noseSize * (1f / 255f); res.noseCurve = noseCurve * (1f / 255f); res.noseWidth = noseWidth * (1f / 255f); res.noseInclination = noseInclination * (1f / 255f); res.nosePosition = nosePosition * (1f / 255f); res.nosePronounced = nosePronounced * (1f / 255f); res.noseFlatten = noseFlatten * (1f / 255f); res.chinSize = chinSize * (1f / 255f); res.chinPronounced = chinPronounced * (1f / 255f); res.chinPosition = chinPosition * (1f / 255f); res.mandibleSize = mandibleSize * (1f / 255f); res.jawsSize = jawsSize * (1f / 255f); res.jawsPosition = jawsPosition * (1f / 255f); res.cheekSize = cheekSize * (1f / 255f); res.cheekPosition = cheekPosition * (1f / 255f); res.lowCheekPronounced = lowCheekPronounced * (1f / 255f); res.lowCheekPosition = lowCheekPosition * (1f / 255f); res.foreheadSize = foreheadSize * (1f / 255f); res.foreheadPosition = foreheadPosition * (1f / 255f); res.lipsSize = lipsSize * (1f / 255f); res.mouthSize = mouthSize * (1f / 255f); res.eyeRotation = eyeRotation * (1f / 255f); res.eyeSize = eyeSize * (1f / 255f); res.breastSize = breastSize * (1f / 255f); return res; }
public static string SaveInstance(UMADnaHumanoid instance) { #if !StripLitJson return LitJson.JsonMapper.ToJson(UMADnaHumanoid_Byte.FromDna(instance)); #else return null; #endif }
public static string SaveInstance(UMADnaHumanoid instance) { return LitJson.JsonMapper.ToJson(UMADnaHumanoid_Byte.FromDna(instance)); }