public static void ProduceNumericKeyWithDefaultValues( ref BodyProperties initialBodyProperties, bool earsAreHidden, int gender, int age) { MBAPI.IMBFaceGen.ProduceNumericKeyWithDefaultValues(ref initialBodyProperties, earsAreHidden, gender, (float)age); }
public Search RemoveBodyProperty(string alias) { if (!BodyProperties.Contains(alias)) { BodyProperties = BodyProperties.Where(x => x != alias).ToArray(); } return(this); }
public void AddSkinMeshesToAgentEntity( UIntPtr agentVisualsId, ref SkinGenerationParams skinParams, ref BodyProperties bodyProperties, bool useFaceCache) { ScriptingInterfaceOfIMBAgentVisuals.call_AddSkinMeshesToAgentEntityDelegate(agentVisualsId, ref skinParams, ref bodyProperties, useFaceCache); }
void IFaceGen.SetPigmentation( ref BodyProperties bodyProperties, int skinColor, int hairColor, int eyeColor) { MBBodyProperties.SetPigmentation(ref bodyProperties, skinColor, hairColor, eyeColor); }
void IFaceGen.SetHair( ref BodyProperties bodyProperties, int hair, int beard, int tattoo) { MBBodyProperties.SetHair(ref bodyProperties, hair, beard, tattoo); }
public Search AddBodyProperty(string alias) { if (!BodyProperties.Contains(alias)) { BodyProperties = BodyProperties.Append(alias).ToArray(); } return(this); }
public void ProduceNumericKeyWithDefaultValues( ref BodyProperties initialBodyProperties, bool earsAreHidden, int gender, float age) { ScriptingInterfaceOfIMBFaceGen.call_ProduceNumericKeyWithDefaultValuesDelegate(ref initialBodyProperties, earsAreHidden, gender, age); }
private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject, Text text) { count++; Kinect.Joint s = body.Joints[Kinect.JointType.WristLeft]; Kinect.Joint t = body.Joints[Kinect.JointType.WristRight]; BodyProperties BP = bodyObject.GetComponent <BodyProperties>(); //text.color = UnityEngine.Color.white; //text.text = BP.startGame.ToString(); //text.text += "\n" + BP.InitializeObj.ToString(); //text.text += "\n" + BP.countinst.ToString(); //text.fontSize = 25; //text.text += "\n" + BP.leftarmLength; //text.text += "\n" + BP.rightarmLength; //text.text = Math.Round(BP.CalculateDistance(s, t), 2).ToString(); //text.text += "\n"+Math.Round(BP.CalculateDistanceByFormula(s, t), 2).ToString(); Kinect.Joint bodyJoint = body.Joints[Kinect.JointType.SpineBase]; bodyObject.transform.position = GetVector3FromJoint(bodyJoint); for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) { Kinect.Joint sourceJoint = body.Joints[jt]; Kinect.Joint?targetJoint = null; if (_BoneMap.ContainsKey(jt)) { targetJoint = body.Joints[_BoneMap[jt]]; } Transform jointObj = bodyObject.transform.Find(jt.ToString()); jointObj.position = GetVector3FromJoint(sourceJoint); if (jointObj.name.Contains("Head") && count % 7 == 0) { JointsProperties jp = jointObj.GetComponent <JointsProperties>(); //Debug.Log(jointObj.name + ": (" + jp.position.x + "," + jp.position.y + "," + jp.position.z + ")"); } GameObject JointObject = jointObj.gameObject; JointsProperties joint = JointObject.GetComponent <JointsProperties>(); joint.position = jointObj.position; joint.UpdateDistanceFromGround(); LineRenderer lr = jointObj.GetComponent <LineRenderer>(); if (targetJoint.HasValue) { lr.SetPosition(0, jointObj.position); lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value)); lr.startColor = GetColorForState(sourceJoint.TrackingState); lr.endColor = GetColorForState(targetJoint.Value.TrackingState); } else { lr.enabled = false; } } }
public static void ChangeBodyProperties(Hero hero, BodyProperties bodyProperties) { FieldInfo fieldInfo = hero.GetType().GetField("StaticBodyProperties", BindingFlags.NonPublic | BindingFlags.Instance); if (null != fieldInfo && null != bodyProperties) { fieldInfo.SetValue(hero, bodyProperties); } }
public TFluent SetTextAnchor(TextAnchoringTypeValues anchor) { OpenXmlElement textBody = this.element.GetOrCreateTextBody(); BodyProperties bodyProperties = textBody.GetFirstChild <BodyProperties>() ?? textBody.AppendChild(new BodyProperties()); bodyProperties.Anchor = anchor; return(this.result); }
private void FillEquipment(BodyProperties bodyProperties, Equipment equipment) { this.BodyProperties = bodyProperties.ToString(); //this.MountCreationKey = TaleWorlds.Core.MountCreationKey.GetRandomMountKey((equipment != null) ? equipment[10].Item : null, Common.GetDJB2(this._character.StringId)); this._equipment = ((equipment != null) ? equipment.Clone(false) : null); Equipment expr_C6 = equipment; this.EquipmentCode = ((expr_C6 != null) ? expr_C6.CalculateEquipmentCode() : null); }
protected new Agent SpawnBot(Team agentTeam, BasicCultureObject cultureLimit) { BasicCharacterObject troopCharacter = MultiplayerClassDivisions.GetMPHeroClasses(cultureLimit).ToList <MultiplayerClassDivisions.MPHeroClass>().GetRandomElement <MultiplayerClassDivisions.MPHeroClass>().TroopCharacter; MatrixFrame spawnFrame = this.SpawnComponent.GetSpawnFrame(agentTeam, troopCharacter.HasMount(), true); AgentBuildData agentBuildData = new AgentBuildData(troopCharacter); agentBuildData.Team(agentTeam); agentBuildData.InitialFrame(spawnFrame); agentBuildData.TroopOrigin((IAgentOriginBase) new BasicBattleAgentOrigin(troopCharacter)); agentBuildData.EquipmentSeed(this.MissionLobbyComponent.GetRandomFaceSeedForCharacter(troopCharacter, 0)); agentBuildData.ClothingColor1(agentTeam.Side == BattleSideEnum.Attacker ? cultureLimit.Color : cultureLimit.ClothAlternativeColor); agentBuildData.ClothingColor2(agentTeam.Side == BattleSideEnum.Attacker ? cultureLimit.Color2 : cultureLimit.ClothAlternativeColor2); agentBuildData.IsFemale(troopCharacter.IsFemale); var randomEquipmentElements = Equipment.GetRandomEquipmentElements(troopCharacter, !(Game.Current.GameType is MultiplayerGame), false, agentBuildData.AgentEquipmentSeed); var items = new Dictionary <ItemObject.ItemTypeEnum, ItemObject>(); foreach (ItemObject.ItemTypeEnum itemtype in ((ItemObject.ItemTypeEnum[])Enum.GetValues( typeof(ItemObject.ItemTypeEnum))).Skip(1)) { switch (itemtype) { case ItemObject.ItemTypeEnum.Goods: case ItemObject.ItemTypeEnum.Pistol: case ItemObject.ItemTypeEnum.Bullets: case ItemObject.ItemTypeEnum.Musket: case ItemObject.ItemTypeEnum.Animal: case ItemObject.ItemTypeEnum.Banner: case ItemObject.ItemTypeEnum.Book: case ItemObject.ItemTypeEnum.ChestArmor: case ItemObject.ItemTypeEnum.Invalid: continue; } items[itemtype] = ItemObject.All .Where(x => x.ItemType == itemtype).GetRandomElement(); } randomEquipmentElements[EquipmentIndex.Weapon0] = new EquipmentElement(items[ItemObject.ItemTypeEnum.OneHandedWeapon], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Weapon1] = new EquipmentElement(items[ItemObject.ItemTypeEnum.Shield], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Weapon2] = new EquipmentElement(items[ItemObject.ItemTypeEnum.Bow], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Weapon3] = new EquipmentElement(items[ItemObject.ItemTypeEnum.Arrows], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Weapon4] = new EquipmentElement(items[ItemObject.ItemTypeEnum.TwoHandedWeapon], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Body] = new EquipmentElement(items[ItemObject.ItemTypeEnum.BodyArmor], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Cape] = new EquipmentElement(items[ItemObject.ItemTypeEnum.Cape], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Gloves] = new EquipmentElement(items[ItemObject.ItemTypeEnum.HandArmor], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Head] = new EquipmentElement(items[ItemObject.ItemTypeEnum.HeadArmor], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Leg] = new EquipmentElement(items[ItemObject.ItemTypeEnum.LegArmor], new ItemModifier()); randomEquipmentElements[EquipmentIndex.Horse] = new EquipmentElement(items[ItemObject.ItemTypeEnum.Horse], new ItemModifier()); agentBuildData.Equipment(randomEquipmentElements); agentBuildData.BodyProperties(BodyProperties.GetRandomBodyProperties(agentBuildData.AgentIsFemale, troopCharacter.GetBodyPropertiesMin(false), troopCharacter.GetBodyPropertiesMax(), (int)agentBuildData.AgentOverridenSpawnEquipment.HairCoverType, agentBuildData.AgentEquipmentSeed, troopCharacter.HairTags, troopCharacter.BeardTags, troopCharacter.TattooTags)); Agent agent = this.Mission.SpawnAgent(agentBuildData, false, 0); agent.AddComponent((AgentComponent) new AgentAIStateFlagComponent(agent)); agent.SetWatchState(AgentAIStateFlagComponent.WatchState.Alarmed); return(agent); }
private static void EscapeOnInit(CharacterCreation characterCreation) //Different from Base { //Use these to get private fields FaceGenChar mother = (FaceGenChar)CharacterCreationContent.Instance.GetType().GetField("_mother", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(CharacterCreationContent.Instance); FaceGenChar father = (FaceGenChar)CharacterCreationContent.Instance.GetType().GetField("_father", BindingFlags.NonPublic | BindingFlags.Instance).GetValue(CharacterCreationContent.Instance); characterCreation.CurrentStage = CharacterCreation.Stages.EscapeMenu; characterCreation.ClearFaceGenPrefab(); ClearCharacters(characterCreation); ClearMountEntity(characterCreation); Hero @object = MBObjectManager.Instance.GetObject <Hero>("tutorial_npc_brother"); List <FaceGenChar> list = new List <FaceGenChar>(); BodyProperties bodyProperties = CharacterObject.PlayerCharacter.GetBodyProperties(CharacterObject.PlayerCharacter.Equipment, -1); bodyProperties = FaceGen.GetBodyPropertiesWithAge(ref bodyProperties, 23f); BodyProperties randomBodyProperties = BodyProperties.GetRandomBodyProperties(CharacterObject.PlayerCharacter.IsFemale, mother.BodyProperties, father.BodyProperties, 1, Hero.MainHero.Mother.CharacterObject.GetDefaultFaceSeed(1), Hero.MainHero.Father.CharacterObject.HairTags, Hero.MainHero.Father.CharacterObject.BeardTags, Hero.MainHero.Father.CharacterObject.TattooTags); randomBodyProperties = new BodyProperties(new DynamicBodyProperties(randomBodyProperties.Age, 0.5f, 0.5f), randomBodyProperties.StaticProperties); @object.ModifyPlayersFamilyAppearance(randomBodyProperties.StaticProperties); @object.DynamicBodyProperties = randomBodyProperties.DynamicProperties; list.Add(new FaceGenChar(bodyProperties, new Equipment(), CharacterObject.PlayerCharacter.IsFemale, "act_childhood_schooled")); // if (CSCharCreationOption.CSWithFamily) { list.Add(new FaceGenChar(@object.BodyProperties, new Equipment(), @object.CharacterObject.IsFemale, "act_brotherhood_schooled")); characterCreation.ChangeFaceGenChars(list); characterCreation.ChangeCharsAnimation(new List <string> { "act_childhood_schooled", "act_brotherhood_schooled" }); } else { characterCreation.ChangeFaceGenChars(list); characterCreation.ChangeCharsAnimation(new List <string> { "act_childhood_schooled", }); } //CharacterCreationContent.Instance.GetType().GetMethod("ChangeStoryStageEquipments", BindingFlags.NonPublic | BindingFlags.Static).Invoke(CharacterCreationContent.Instance, new object[] { characterCreation }); **Cant invoke due to Hardcoded change brother ChangeStoryStageEquipments(characterCreation); List <FaceGenMount> list2 = new List <FaceGenMount>(); if (CharacterObject.PlayerCharacter.HasMount()) { ItemObject item = CharacterObject.PlayerCharacter.Equipment[EquipmentIndex.ArmorItemEndSlot].Item; list2.Add(new FaceGenMount(MountCreationKey.FromString(MountCreationKey.GetRandomMountKey(item, 2)), CharacterObject.PlayerCharacter.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, CharacterObject.PlayerCharacter.Equipment[EquipmentIndex.HorseHarness].Item, "act_inventory_idle_start")); } if (@object.CharacterObject.HasMount()) { ItemObject item2 = @object.CharacterObject.Equipment[EquipmentIndex.ArmorItemEndSlot].Item; list2.Add(new FaceGenMount(MountCreationKey.FromString(MountCreationKey.GetRandomMountKey(item2, 2)), @object.CharacterObject.Equipment[EquipmentIndex.ArmorItemEndSlot].Item, @object.CharacterObject.Equipment[EquipmentIndex.HorseHarness].Item, "act_inventory_idle_start")); } }
GameObject CreateNewBody(string bodyName, BodyProperties props) { GameObject newBody; newBody = (GameObject)Instantiate(planetPrefab, transform.position, transform.rotation); newBody.name = bodyName; newBody.transform.localScale = new Vector3(props.size, props.size, 1.0f); SpriteRenderer renderer = newBody.GetComponent<SpriteRenderer>(); renderer.color = props.color; return newBody; }
// This method will be used to create star system manually, or to customize it. public void AddBodyTo(string parentBody, BodyProperties body, OrbitProperties orbit, string bodyName) { // This will be added to the root of the system, // Stars and main planets will belong to this level. GameObject newBody = CreateNewBody(bodyName, body); OrbitingBody orbitScript = CreateNewOrbit(bodyName, parentBody, orbit); orbitScript.AddBody(newBody, body); }
public void DoGesture(string gestureName) { BodyProperties BP = GameObject.Find("skeleton").GetComponentInChildren <BodyProperties>(); if (BP != null) { BP.updateGesture(gestureName); gestureCount--; } }
public static void SetPigmentation( ref BodyProperties bodyProperties, int skinColor, int hairColor, int eyeColor) { FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create(); MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false); MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties); }
public AgentVisualHolder( MatrixFrame frame, Equipment equipment, string name, BodyProperties bodyProperties) { this.SetFrame(ref frame); this._equipment = equipment; this._characterObjectStringID = name; this._bodyProperties = bodyProperties; }
public FaceGenerationParams InitBodyGenerator() { this.CurrentBodyProperties = this.Character.GetBodyProperties(this.Character.Equipment); FaceGenerationParams faceGenerationParams = FaceGenerationParams.Create(); faceGenerationParams._currentGender = this.Character.IsFemale ? 1 : 0; faceGenerationParams._curAge = this.Character.Age; MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, this.CurrentBodyProperties, this.Character.Equipment.EarsAreHidden); faceGenerationParams.SetGenderAndAdjustParams(faceGenerationParams._currentGender, (int)faceGenerationParams._curAge); return(faceGenerationParams); }
void OnTriggerStay(Collider other) { if (other.gameObject.name.Contains(this.name)) { BodyProperties BP = transform.parent.gameObject.GetComponent <BodyProperties>(); if (BP.getType() == "Static") { BP.GD.gestureTrue = true; } } }
public static void GenerateParentKey( BodyProperties childBodyProperties, ref BodyProperties motherBodyProperties, ref BodyProperties fatherBodyProperties) { if (FaceGen._instance == null) { return; } FaceGen._instance.GenerateParentBody(childBodyProperties, ref motherBodyProperties, ref fatherBodyProperties); }
public static void SetPigmentation( ref BodyProperties bodyProperties, int skinColor, int hairColor, int eyeColor) { if (FaceGen._instance == null) { return; } FaceGen._instance.SetPigmentation(ref bodyProperties, skinColor, hairColor, eyeColor); }
public static BodyProperties GetRandomBodyProperties( bool isFemale, BodyProperties bodyPropertiesMin, BodyProperties bodyPropertiesMax, int hairCoverType, int seed, string hairTags, string beardTags, string tatooTags) { return(FaceGen._instance != null?FaceGen._instance.GetRandomBodyProperties(isFemale, bodyPropertiesMin, bodyPropertiesMax, hairCoverType, seed, hairTags, beardTags, tatooTags) : bodyPropertiesMin); }
public TFluent SetTextMargin(long left, long top, long right, long bottom) { OpenXmlElement textBody = this.element.GetOrCreateTextBody(); BodyProperties bodyProperties = textBody.GetFirstChild <BodyProperties>() ?? textBody.AppendChild(new BodyProperties()); bodyProperties.LeftInset = (int)left; bodyProperties.TopInset = (int)top; bodyProperties.RightInset = (int)right; bodyProperties.BottomInset = (int)bottom; return(this.result); }
public OpenXmlMargin GetTextMargin() { OpenXmlElement textBody = this.element.GetTextBody(); BodyProperties bodyProperties = textBody.GetFirstChild <BodyProperties>(); return(new OpenXmlMargin( bodyProperties?.LeftInset ?? (long)OpenXmlUnit.Inch(0.1), bodyProperties?.TopInset ?? (long)OpenXmlUnit.Inch(0.05), bodyProperties?.RightInset ?? (long)OpenXmlUnit.Inch(0.1), bodyProperties?.BottomInset ?? (long)OpenXmlUnit.Inch(0.05) )); }
GameObject CreateNewBody(string bodyName, BodyProperties props) { GameObject newBody; newBody = (GameObject)Instantiate(planetPrefab, transform.position, transform.rotation); newBody.name = bodyName; newBody.transform.localScale = new Vector3(props.size, props.size, 1.0f); SpriteRenderer renderer = newBody.GetComponent <SpriteRenderer>(); renderer.color = props.color; return(newBody); }
private GameObject CreateBodyObject(ulong id) { GameObject body = new GameObject("Body:" + id); //body.transform.position = new Vector3(0.0f, 10.0f, 0.0f); for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) { GameObject jointObj = GameObject.CreatePrimitive(PrimitiveType.Sphere); jointObj.name = "Skeleton" + jt.ToString(); SphereCollider scj = jointObj.GetComponent <SphereCollider>(); scj.isTrigger = true; if (jt == Kinect.JointType.HandLeft || jt == Kinect.JointType.HandRight) { scj.radius = 1.5f; } Rigidbody rbj = jointObj.AddComponent <Rigidbody>() as Rigidbody; rbj.useGravity = false; jointObj.AddComponent <colloideDetect>(); JointsProperties joint = jointObj.AddComponent <JointsProperties>(); joint.name = jt.ToString(); joint.floor = floorClipPlane; LineRenderer lr = jointObj.AddComponent <LineRenderer>(); lr.positionCount = 2; lr.material = pickup; lr.startWidth = 0.05f; lr.endWidth = 0.05f; jointObj.transform.localScale = new Vector3(0.1f, 0.1f, 0.1f); jointObj.name = "Skeleton" + jt.ToString(); jointObj.transform.parent = body.transform; } body.transform.parent = transform; body.tag = "SkeletonBody"; BodyProperties BP = body.AddComponent <BodyProperties>(); BP.ParentCircle = startCircle; //BP.MJ = MJ; Rigidbody rb = body.AddComponent <Rigidbody>(); CapsuleCollider cc = body.AddComponent <CapsuleCollider>(); cc.isTrigger = true; cc.height = 2.5f; cc.radius = 0.1f; StartCircle.player = body; rb.useGravity = false; return(body); }
public BodyProperties GetRandomBodyProperties( bool isFemale, BodyProperties bodyPropertiesMin, BodyProperties bodyPropertiesMax, int hairCoverType, int seed, string hairTags, string beardTags, string tatooTags) { return(MBBodyProperties.GetRandomBodyProperties(isFemale, bodyPropertiesMin, bodyPropertiesMax, hairCoverType, seed, hairTags, beardTags, tatooTags)); }
private void RefreshBodyObject(Kinect.Body body, GameObject bodyObject) { count++; Kinect.Joint s = body.Joints[Kinect.JointType.WristLeft]; Kinect.Joint t = body.Joints[Kinect.JointType.WristRight]; BodyProperties BP = bodyObject.GetComponent <BodyProperties>(); Kinect.Joint bodyJoint = body.Joints[Kinect.JointType.SpineBase]; bodyObject.transform.position = GetVector3FromJoint(bodyJoint); Kinect.Vector4 BodyOrientation = body.JointOrientations[Kinect.JointType.SpineBase].Orientation; bodyObject.transform.rotation = GetQuaterion(BodyOrientation); for (Kinect.JointType jt = Kinect.JointType.SpineBase; jt <= Kinect.JointType.ThumbRight; jt++) { Kinect.Joint sourceJoint = body.Joints[jt]; Kinect.Joint?targetJoint = null; if (_BoneMap.ContainsKey(jt)) { targetJoint = body.Joints[_BoneMap[jt]]; } Transform jointObj = bodyObject.transform.Find("Skeleton" + jt.ToString()); jointObj.position = GetVector3FromJoint(sourceJoint); if (jointObj.name.Contains("Head") && count % 7 == 0) { JointsProperties jp = jointObj.GetComponent <JointsProperties>(); //Debug.Log(jointObj.name + ": (" + jp.position.x + "," + jp.position.y + "," + jp.position.z + ")"); } GameObject JointObject = jointObj.gameObject; JointsProperties joint = JointObject.GetComponent <JointsProperties>(); joint.position = jointObj.position; joint.UpdateDistanceFromGround(); joint.TrackingState = sourceJoint.TrackingState; JointObject.GetComponent <Renderer>().material.color = GetColorForState(sourceJoint.TrackingState); LineRenderer lr = jointObj.GetComponent <LineRenderer>(); if (targetJoint.HasValue) { lr.SetPosition(0, jointObj.position); lr.SetPosition(1, GetVector3FromJoint(targetJoint.Value)); lr.startColor = GetColorForState(sourceJoint.TrackingState); lr.endColor = GetColorForState(targetJoint.Value.TrackingState); } else { lr.enabled = false; } } }
void OnTriggerEnter(Collider other) { if (other.name.Contains("malcolm")) { BodyProperties BP = GameObject.Find("skeleton").GetComponentInChildren <BodyProperties>(); if (BP != null) { BP.GD.accuracy = 0; } scoring sc = GameObject.Find("Scoring").GetComponent <scoring>(); sc.setGesture(2); } }
public static BodyProperties GetBodyPropertiesWithAge( ref BodyProperties bodyProperties, float age) { FaceGenerationParams faceGenerationParams = new FaceGenerationParams(); MBBodyProperties.GetParamsFromKey(ref faceGenerationParams, bodyProperties, false); faceGenerationParams._curAge = age; BodyProperties bodyProperties1 = new BodyProperties(); MBBodyProperties.ProduceNumericKeyWithParams(faceGenerationParams, false, ref bodyProperties1); return(bodyProperties1); }