// Use this for initialization void Start() { Pelvis = this.transform.Find("Armature/Parent/Pelvis").gameObject; Leg_L = this.transform.Find("Armature/Parent/Pelvis/Leg.L").gameObject; Knee_L = this.transform.Find("Armature/Parent/Pelvis/Leg.L/Knee.L").gameObject; Leg_R = this.transform.Find("Armature/Parent/Pelvis/Leg.R").gameObject; Knee_R = this.transform.Find("Armature/Parent/Pelvis/Leg.R/Knee.R").gameObject; Spine1 = this.transform.Find("Armature/Parent/Pelvis/Spine1").gameObject; Spine2 = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2").gameObject; Head = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/Head").gameObject; LeftArm = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/LeftArm").gameObject; LeftElbow = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/LeftArm/LeftElbow").gameObject; RightArm = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/RightArm").gameObject; RightElbow = this.transform.Find("Armature/Parent/Pelvis/Spine1/Spine2/RightArm/RightElbow").gameObject; part = new GameObject[] { Pelvis, Leg_L, Knee_L, Leg_R, Knee_R, Spine1, Spine2, Head, LeftArm, LeftElbow, RightArm, RightElbow }; RB = new Rigidbody[] { Pelvis.GetComponent <Rigidbody>(), Leg_L.GetComponent <Rigidbody>(), Knee_L.GetComponent <Rigidbody>(), Leg_R.GetComponent <Rigidbody>(), Knee_R.GetComponent <Rigidbody>(), Spine1.GetComponent <Rigidbody>(), LeftArm.GetComponent <Rigidbody>(), LeftElbow.GetComponent <Rigidbody>(), RightArm.GetComponent <Rigidbody>(), RightElbow.GetComponent <Rigidbody>() }; foreach (Rigidbody rb in RB) { rb.velocity = vel; } int n = 0; foreach (Quaternion rot in rotation) { part[n].transform.rotation = rot; n++; } }
public WalkingDead(RectangleF frame) : base(frame) { BackgroundColor = UIColor.Clear; ClipsToBounds = false; head = new Head(new RectangleF(0, 0, Frame.Size.Width, Frame.Size.Height * .25f)); AddSubview(head); body = new Body(new RectangleF(0, head.Frame.GetMaxY(), Frame.Size.Width, Frame.Size.Height * .375f)); AddSubview(body); leftArm = new LeftArm(new RectangleF(0, 0, Frame.Size.Width + 20, Frame.Size.Height)); AddSubview(leftArm); rightArm = new RightArm(new RectangleF(0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview(rightArm); rightLeg = new RightLeg(new RectangleF(0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview(rightLeg); leftLeg = new LeftLeg(new RectangleF(0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview(leftLeg); TurnAround(); }
public void onClickL() { LeftArmPunch.SetBool("Attacking", true); FireballShot.Play(); Debug.Log("Левая"); HeroAnim.SetBool("AttackingLeft", true); LeftArm.SetActive(true); StartCoroutine("UndoAction"); }
public String NameOfPart(int partNum) // I am truly sorry for this method! { String name = ""; Part thePart = parts[partNum]; if (thePart is Head) { Head head = (Head)thePart; name = "Head: " + thePart.PartName; name += " Class: " + (int)head.PartRank; name += " Scan Level: " + (int)head.EnemyScanAbility; name += " Missle Defense Rate: " + head.MissileInterceptionRate; } if (thePart is Core) { Core core = (Core)thePart; name = "Core: " + thePart.PartName; name += " Class:" + (int)core.PartRank; name += " HP: " + core.MaxHp; } if (thePart is LeftArm) { LeftArm leftArm = (LeftArm)thePart; name = "Left Arm: " + thePart.PartName; name += " Class: " + (int)leftArm.PartRank; name += " Blade Length: " + leftArm.SwordLength; name += " Blade Damage: " + leftArm.SwordDamage; } if (thePart is RightArm) { RightArm rightArm = (RightArm)thePart; name = "Right Arm: " + thePart.PartName; name += " Class: " + (int)rightArm.PartRank; name += " Size: " + rightArm.ProjectileSize; name += " Damage: " + rightArm.Damage; } if (thePart is Shoulders) { Shoulders shoudlers = (Shoulders)thePart; name = "Shoulder: " + thePart.PartName; name += " Class: " + (int)shoudlers.PartRank; name += " Size: " + shoudlers.MissleSize; name += " Damage: " + shoudlers.Damage; } if (thePart is Legs) { Legs legs = (Legs)thePart; name = "Legs: " + thePart.PartName; name += " Class: " + (int)legs.PartRank; name += " Speed: " + legs.SpeedTilesPerSecond; name += " Hover: " + ((legs.Movement.Water != MoveQuality.none) ? "True" : "False"); name += " Heat Resist: " + ((legs.Movement.Water != MoveQuality.none) ? "True" : "False"); } return(name); }
IEnumerator UndoAction() { yield return(new WaitForSeconds(0.3f)); Debug.Log("Отключаю"); LeftArm.SetActive(false); RightArm.SetActive(false); LeftArmPunch.SetBool("Attacking", false); RightArmPunch.SetBool("Attacking", false); HeroAnim.SetBool("AttackingRight", false); HeroAnim.SetBool("AttackingLeft", false); }
public void Initialize() { head = transform.Find("Head"); rbHead = head.GetComponent <Rigidbody>(); body = transform.Find("Body"); rbBody = body.GetComponent <Rigidbody>(); armL = transform.Find("LeftArm"); LeftArm = armL.GetComponent <Arm>(); LeftArm.Initialize(-15, 105, -90, 90, 0, 135); defAnchorL = anchorL; armR = transform.Find("RightArm"); RightArm = armR.GetComponent <Arm>(); RightArm.Initialize(-15, 105, -90, 90, -135, 0); defAnchorR = anchorR; }
static void Main(string[] args) { var getHead = new Head(); var getHeadCovering = new HeadCovering(); var getLeftArm = new LeftArm(); var getRightArm = new RightArm(); var getLegs = new Legs(); Console.WriteLine("You have been given a basic body piece. It is up to you to create the perfect specimen of Legohood."); var figureItems = new FigureBase[] { getHead, getHeadCovering, getLeftArm, getRightArm, getLegs }; foreach (var piece in figureItems) { piece.GetPiece(); } Console.WriteLine("Press Enter to Escape"); }
public Skeleton ToNetworkModel() { Skeleton s = new Skeleton(); s.UserId = UserId; s.BodyLocation = BodyLocation.ToCoord(); s.BodyRotation = BodyRotation.ToCoord(); s.Head = Head.ToCoord(); s.Neck = Neck.ToCoord(); s.Spine = Spine.ToCoord(); s.Hips = Hips.ToCoord(); s.LeftShoulder = LeftShoulder.ToCoord(); s.LeftArm = LeftArm.ToCoord(); s.LeftHand = LeftHand.ToCoord(); s.RightShoulder = RightShoulder.ToCoord(); s.RightArm = RightArm.ToCoord(); s.RightHand = RightHand.ToCoord(); s.LeftKnee = LeftKnee.ToCoord(); s.LeftFoot = LeftFoot.ToCoord(); s.RightKnee = RightKnee.ToCoord(); s.RightFoot = RightFoot.ToCoord(); return(s); }
void Update() { //if (transform.rotation.eulerAngles.z > 90 && transform.rotation.eulerAngles.z < 270) Kill(); //if (transform.position.x < -0.2f) //{ // net.SetFitness(-999); // net.SetTimeAlive(-999); // Kill(); //} if (dontReward) { return; } if (netInitalized && manager.Countdown > 0) { if (_shouldPunish < 0) { _shouldPunish = 0; } float[] inputs = { HeadTransform.rotation.z, LeftArmTransform.rotation.z, RightArmTransform.rotation.z, LeftLegTransform.rotation.z, LeftFootTransform.rotation.z, RightLegTransform.rotation.z, RightFootTransform.rotation.z, _shouldPunish > 0f ? 100f : 0f, transform.position.x, Chest.transform.rotation.z, Chest.velocity.x, Chest.velocity.y, LeftLeg.velocity.x, LeftLeg.velocity.y, LeftLeg.angularVelocity, LeftFoot.velocity.x, LeftFoot.velocity.y, LeftFoot.angularVelocity, RightLeg.velocity.x, RightLeg.velocity.y, RightLeg.angularVelocity, RightFoot.velocity.x, RightFoot.velocity.y, RightFoot.angularVelocity, Vector2.Distance(new Vector2(transform.position.x, 0), new Vector2(WoD.Pos, 0)) }; float[] neurons = net.FeedForward(inputs); //HeadTransform.Rotate(Vector3.forward , neurons[(int)Neuron.Head]); //LeftArmTransform.Rotate(Vector3.forward , neurons[(int)Neuron.LeftArm]); //RightArmTransform.Rotate(Vector3.forward , neurons[(int)Neuron.RightArm]); //LeftLegTransform.Rotate(Vector3.forward , neurons[(int)Neuron.LeftLeg]); //LeftFootTransform.Rotate(Vector3.forward , neurons[(int)Neuron.LeftFoot]); //RightLegTransform.Rotate(Vector3.forward , neurons[(int)Neuron.RightLeg]); //RightFootTransform.Rotate(Vector3.forward , neurons[(int)Neuron.RightFoot]); //ChestTransform.Rotate(Vector3.forward , neurons[(int)Neuron.Torso]); Head.AddTorque(neurons[(int)Neuron.Head] * 5f, ForceMode2D.Force); LeftArm.AddTorque(neurons[(int)Neuron.LeftArm] * 5f, ForceMode2D.Force); RightArm.AddTorque(neurons[(int)Neuron.RightArm] * 5f, ForceMode2D.Force); LeftLeg.AddTorque(neurons[(int)Neuron.LeftLeg] * 20f, ForceMode2D.Force); LeftFoot.AddTorque(neurons[(int)Neuron.LeftFoot] * 20f, ForceMode2D.Force); RightLeg.AddTorque(neurons[(int)Neuron.RightLeg] * 20f, ForceMode2D.Force); RightFoot.AddTorque(neurons[(int)Neuron.RightFoot] * 20f, ForceMode2D.Force); Chest.AddTorque(neurons[(int)Neuron.Torso] * 5f, ForceMode2D.Force); if (_shouldPunish > 0) { if (killTimerValue > 0) { killTimerValue -= Time.deltaTime; } else { Kill(); } } else { net.SetFitness(transform.position.x * 2); killTimerValue = killTimer; } net.SetTimeAlive(timeAlive); currentScore = net.GetFitness(); lastPosition = transform.position.x; if (WoD.Pos >= transform.position.x) { Kill(); } } timeAlive += Time.deltaTime; }
private void ExportBodypart_Click(object sender, RoutedEventArgs e) { string id = InputModname.Text + "_" + InputBodypartName.Text; if (string.IsNullOrWhiteSpace(InputModname.Text)) { LabelStatus.Content = "Export failed! Please fill out the Modname."; StatusTimer(); return; } if (string.IsNullOrWhiteSpace(InputBodypartName.Text)) { LabelStatus.Content = "Export failed! Please fill out the Bodypartname."; StatusTimer(); return; } string path; string bodytype = selectedBodytype.SelectedItem.ToString(); string color = selectedColor.SelectedItem.ToString(); string race = selectedRace.SelectedItem.ToString(); if (string.IsNullOrWhiteSpace(parentWindow.modFolderPath)) { path = System.AppDomain.CurrentDomain.BaseDirectory + "Exported\\"; } else { path = parentWindow.modFolderPath + "\\"; } string bodypart = (selectedBodypart.SelectedItem as ComboBoxItem).Content as string; Int32.TryParse(InputCharisma.Text, out int charisma); Int32.TryParse(InputConstitution.Text, out int constitution); Int32.TryParse(InputDexterity.Text, out int dexterity); Int32.TryParse(InputIntelligence.Text, out int intelligence); Int32.TryParse(InputStrength.Text, out int strength); Int32.TryParse(InputWisdom.Text, out int wisdom); path += InputModname.Text + "\\Bodyparts\\" + race + "\\" + bodypart + "s\\"; Int32.TryParse(InputHealthpoints.Text, out int maxHP); if (!Directory.Exists(path)) { Directory.CreateDirectory(path); } Bodypart b = null; switch (bodypart) { case "Head": b = new Head(constitution, intelligence, wisdom, charisma, color, bodytype, race); break; case "Torso": b = new Torso(constitution, strength, dexterity, charisma, color, bodytype, race); break; case "Right Arm": b = new RightArm(constitution, strength, dexterity, charisma, color, bodytype, race); break; case "Left Arm": b = new LeftArm(constitution, strength, dexterity, charisma, color, bodytype, race); break; case "Right Leg": b = new RightLeg(constitution, strength, dexterity, charisma, color, bodytype, race); break; case "Left Leg": b = new LeftLeg(constitution, strength, dexterity, charisma, color, bodytype, race); break; } b.id = id; b.MaxHP = maxHP; b.Name = InputBodypartName.Text; parentWindow.CopyFile(InputIconPath.Text, path); b.Icon = parentWindow.TrimPath(InputIconPath.Text); parentWindow.CopyFile(InputIdleDownAnimationPath.Text, path); b.idleDownAnimation = parentWindow.TrimPath(InputIdleDownAnimationPath.Text); parentWindow.CopyFile(InputIdleUpAnimationPath.Text, path); b.idleUpAnimation = parentWindow.TrimPath(InputIdleUpAnimationPath.Text); parentWindow.CopyFile(InputIdleRightAnimationPath.Text, path); b.idleRightAnimation = parentWindow.TrimPath(InputIdleRightAnimationPath.Text); parentWindow.CopyFile(InputIdleLeftAnimationPath.Text, path); b.idleLeftAnimation = parentWindow.TrimPath(InputIdleLeftAnimationPath.Text); parentWindow.CopyFile(InputWalkDownAnimationPath.Text, path); b.walkDownAnimation = parentWindow.TrimPath(InputWalkDownAnimationPath.Text); parentWindow.CopyFile(InputWalkUpAnimationPath.Text, path); b.walkUpAnimation = parentWindow.TrimPath(InputWalkUpAnimationPath.Text); parentWindow.CopyFile(InputWalkRightAnimationPath.Text, path); b.walkRightAnimation = parentWindow.TrimPath(InputWalkRightAnimationPath.Text); parentWindow.CopyFile(InputWalkLeftAnimationPath.Text, path); b.walkLeftAnimation = parentWindow.TrimPath(InputWalkLeftAnimationPath.Text); parentWindow.CopyFile(InputAttackDownAnimationPath.Text, path); b.attackDownAnimation = parentWindow.TrimPath(InputAttackDownAnimationPath.Text); parentWindow.CopyFile(InputAttackUpAnimationPath.Text, path); b.attackUpAnimation = parentWindow.TrimPath(InputAttackUpAnimationPath.Text); parentWindow.CopyFile(InputAttackRightAnimationPath.Text, path); b.attackRightAnimation = parentWindow.TrimPath(InputAttackRightAnimationPath.Text); parentWindow.CopyFile(InputAttackLeftAnimationPath.Text, path); b.attackLeftAnimation = parentWindow.TrimPath(InputAttackLeftAnimationPath.Text); parentWindow.CopyFile(InputMagicDownAnimationPath.Text, path); b.magicDownAnimation = parentWindow.TrimPath(InputMagicDownAnimationPath.Text); parentWindow.CopyFile(InputMagicUpAnimationPath.Text, path); b.magicUpAnimation = parentWindow.TrimPath(InputMagicUpAnimationPath.Text); parentWindow.CopyFile(InputMagicRightAnimationPath.Text, path); b.magicRightAnimation = parentWindow.TrimPath(InputMagicRightAnimationPath.Text); parentWindow.CopyFile(InputMagicLeftAnimationPath.Text, path); b.magicLeftAnimation = parentWindow.TrimPath(InputMagicLeftAnimationPath.Text); switch (bodypart) { case "Head": Head h = b as Head; h.skillIDs = new string[3] { InputSkill1.Text, InputSkill2.Text, InputSkill3.Text }; XMLManager.Save(path + id, h); break; case "Torso": Torso t = b as Torso; t.skillIDs = new string[2] { InputSkill1.Text, InputSkill2.Text }; XMLManager.Save(path + id, t); break; case "Right Arm": RightArm ra = b as RightArm; ra.skillIDs = new string[2] { InputSkill1.Text, InputSkill2.Text }; XMLManager.Save(path + id, ra); break; case "Left Arm": LeftArm la = b as LeftArm; la.skillIDs = new string[2] { InputSkill1.Text, InputSkill2.Text }; XMLManager.Save(path + id, la); break; case "Right Leg": RightLeg rl = b as RightLeg; rl.skillIDs = new string[1] { InputSkill1.Text }; XMLManager.Save(path + id, rl); break; case "Left Leg": LeftLeg ll = b as LeftLeg; ll.skillIDs = new string[1] { InputSkill1.Text }; XMLManager.Save(path + id, ll); break; } LabelStatus.Content = "Export successful."; StatusTimer(); }
public WalkingDead (RectangleF frame) :base (frame) { BackgroundColor = UIColor.Clear; ClipsToBounds = false; head = new Head (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height * .25f)); AddSubview (head); body = new Body (new RectangleF (0, head.Frame.GetMaxY (), Frame.Size.Width, Frame.Size.Height * .375f)); AddSubview (body); leftArm = new LeftArm (new RectangleF (0, 0, Frame.Size.Width + 20, Frame.Size.Height)); AddSubview (leftArm); rightArm = new RightArm (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview (rightArm); rightLeg = new RightLeg (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview (rightLeg); leftLeg = new LeftLeg (new RectangleF (0, 0, Frame.Size.Width, Frame.Size.Height)); AddSubview (leftLeg); TurnAround (); }
public void SetUp() { _target = new LeftArm(); }
public async Task Init() { await Task.WhenAll(new Task[] { RightArm.Init(), LeftArm.Init() }); }
/// <summary> /// Runs the same procedure for both arms. /// </summary> /// <param name="procedureName">The name of the procdure.</param> public async Task RunProcedureForBothArms(string procedureName) { await Task.WhenAll( LeftArm.RunProcedure(procedureName), RightArm.RunProcedure(procedureName)); }
public async Task Init() { await Task.WhenAll( LeftArm.Init(), RightArm.Init()); }
public Shoulder(LeftArm leftArm) { _robotPart = leftArm; }
public void MergeFrom(Skeleton other) { if (other == null) { return; } if (other.UserId != 0UL) { UserId = other.UserId; } if (other.bodyLocation_ != null) { if (bodyLocation_ == null) { bodyLocation_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } BodyLocation.MergeFrom(other.BodyLocation); } if (other.bodyRotation_ != null) { if (bodyRotation_ == null) { bodyRotation_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } BodyRotation.MergeFrom(other.BodyRotation); } if (other.head_ != null) { if (head_ == null) { head_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } Head.MergeFrom(other.Head); } if (other.neck_ != null) { if (neck_ == null) { neck_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } Neck.MergeFrom(other.Neck); } if (other.spine_ != null) { if (spine_ == null) { spine_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } Spine.MergeFrom(other.Spine); } if (other.hips_ != null) { if (hips_ == null) { hips_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } Hips.MergeFrom(other.Hips); } if (other.leftShoulder_ != null) { if (leftShoulder_ == null) { leftShoulder_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } LeftShoulder.MergeFrom(other.LeftShoulder); } if (other.leftArm_ != null) { if (leftArm_ == null) { leftArm_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } LeftArm.MergeFrom(other.LeftArm); } if (other.leftHand_ != null) { if (leftHand_ == null) { leftHand_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } LeftHand.MergeFrom(other.LeftHand); } if (other.rightShoulder_ != null) { if (rightShoulder_ == null) { rightShoulder_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } RightShoulder.MergeFrom(other.RightShoulder); } if (other.rightArm_ != null) { if (rightArm_ == null) { rightArm_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } RightArm.MergeFrom(other.RightArm); } if (other.rightHand_ != null) { if (rightHand_ == null) { rightHand_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } RightHand.MergeFrom(other.RightHand); } if (other.leftKnee_ != null) { if (leftKnee_ == null) { leftKnee_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } LeftKnee.MergeFrom(other.LeftKnee); } if (other.leftFoot_ != null) { if (leftFoot_ == null) { leftFoot_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } LeftFoot.MergeFrom(other.LeftFoot); } if (other.rightKnee_ != null) { if (rightKnee_ == null) { rightKnee_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } RightKnee.MergeFrom(other.RightKnee); } if (other.rightFoot_ != null) { if (rightFoot_ == null) { rightFoot_ = new global::VrLifeShared.Networking.NetworkingModels.Coord(); } RightFoot.MergeFrom(other.RightFoot); } }
public override int GetHashCode() { int hash = 1; if (UserId != 0UL) { hash ^= UserId.GetHashCode(); } if (bodyLocation_ != null) { hash ^= BodyLocation.GetHashCode(); } if (bodyRotation_ != null) { hash ^= BodyRotation.GetHashCode(); } if (head_ != null) { hash ^= Head.GetHashCode(); } if (neck_ != null) { hash ^= Neck.GetHashCode(); } if (spine_ != null) { hash ^= Spine.GetHashCode(); } if (hips_ != null) { hash ^= Hips.GetHashCode(); } if (leftShoulder_ != null) { hash ^= LeftShoulder.GetHashCode(); } if (leftArm_ != null) { hash ^= LeftArm.GetHashCode(); } if (leftHand_ != null) { hash ^= LeftHand.GetHashCode(); } if (rightShoulder_ != null) { hash ^= RightShoulder.GetHashCode(); } if (rightArm_ != null) { hash ^= RightArm.GetHashCode(); } if (rightHand_ != null) { hash ^= RightHand.GetHashCode(); } if (leftKnee_ != null) { hash ^= LeftKnee.GetHashCode(); } if (leftFoot_ != null) { hash ^= LeftFoot.GetHashCode(); } if (rightKnee_ != null) { hash ^= RightKnee.GetHashCode(); } if (rightFoot_ != null) { hash ^= RightFoot.GetHashCode(); } return(hash); }
public Shoulder() { LeftArm = new LeftArm(); }
public void setHero_LeftArm(LeftArm hero_LeftArm) { this.hero_LeftArm = hero_LeftArm; }