protected void setHitboxes(MoveTable.move m) { LHand.set(baseAttack * MoveTable.use(m, color, MoveTable.hitbox.lh)); RHand.set(baseAttack * MoveTable.use(m, color, MoveTable.hitbox.rh)); LFoot.set(baseAttack * MoveTable.use(m, color, MoveTable.hitbox.lf)); RFoot.set(baseAttack * MoveTable.use(m, color, MoveTable.hitbox.rf)); }
protected IEnumerator waitforattack(float f) { yield return(new WaitForSeconds(f)); CannotAttack = false; LHand.Reset(); RHand.Reset(); LFoot.Reset(); RFoot.Reset(); }
void _body_leg_direct() { if (_spine_circle.enabled) { finish_roll(); } /*for (_iii = 6; _iii < 13; ++_iii) * m_joints[_iii].direct(m_dir_leg);*/ _aaa = custom_direct_leg(LThigh, LCalf, m_dir_leg); _bbb = custom_direct_leg(RThigh, RCalf, m_dir_leg); _aaa = (_aaa + _bbb) * .5f; SpineD.apply_target_angle(_aaa, true); LFoot.apply_target_angle(80f); RFoot.apply_target_angle(80f); m_leg_grouped = false; if (m_relaxed) { m_relaxed = false; } _need_leg_act = e_need_action.nothing; }
public Biped(World w, Vec2 position) { _world = w; BipedDef def = new BipedDef(); BodyDef bd = new BodyDef(); // create body parts bd = def.LFootDef; bd.Position += position; LFoot = w.CreateBody(bd); LFoot.CreateShape(def.LFootPoly); LFoot.SetMassFromShapes(); bd = def.RFootDef; bd.Position += position; RFoot = w.CreateBody(bd); RFoot.CreateShape(def.RFootPoly); RFoot.SetMassFromShapes(); bd = def.LCalfDef; bd.Position += position; LCalf = w.CreateBody(bd); LCalf.CreateShape(def.LCalfPoly); LCalf.SetMassFromShapes(); bd = def.RCalfDef; bd.Position += position; RCalf = w.CreateBody(bd); RCalf.CreateShape(def.RCalfPoly); RCalf.SetMassFromShapes(); bd = def.LThighDef; bd.Position += position; LThigh = w.CreateBody(bd); LThigh.CreateShape(def.LThighPoly); LThigh.SetMassFromShapes(); bd = def.RThighDef; bd.Position += position; RThigh = w.CreateBody(bd); RThigh.CreateShape(def.RThighPoly); RThigh.SetMassFromShapes(); bd = def.PelvisDef0; bd.Position += position; Pelvis = w.CreateBody(bd); Pelvis.CreateShape(def.PelvisPoly); Pelvis.SetMassFromShapes(); bd = def.PelvisDef; bd.Position += position; Stomach = w.CreateBody(bd); Stomach.CreateShape(def.StomachPoly); Stomach.SetMassFromShapes(); bd = def.ChestDef; bd.Position += position; Chest = w.CreateBody(bd); Chest.CreateShape(def.ChestPoly); Chest.SetMassFromShapes(); bd = def.NeckDef; bd.Position += position; Neck = w.CreateBody(bd); Neck.CreateShape(def.NeckPoly); Neck.SetMassFromShapes(); bd = def.HeadDef; bd.Position += position; Head = w.CreateBody(bd); Head.CreateShape(def.HeadCirc); Head.SetMassFromShapes(); bd = def.LUpperArmDef; bd.Position += position; LUpperArm = w.CreateBody(bd); LUpperArm.CreateShape(def.LUpperArmPoly); LUpperArm.SetMassFromShapes(); bd = def.RUpperArmDef; bd.Position += position; RUpperArm = w.CreateBody(bd); RUpperArm.CreateShape(def.RUpperArmPoly); RUpperArm.SetMassFromShapes(); bd = def.LForearmDef; bd.Position += position; LForearm = w.CreateBody(bd); LForearm.CreateShape(def.LForearmPoly); LForearm.SetMassFromShapes(); bd = def.RForearmDef; bd.Position += position; RForearm = w.CreateBody(bd); RForearm.CreateShape(def.RForearmPoly); RForearm.SetMassFromShapes(); bd = def.LHandDef; bd.Position += position; LHand = w.CreateBody(bd); LHand.CreateShape(def.LHandPoly); LHand.SetMassFromShapes(); bd = def.RHandDef; bd.Position += position; RHand = w.CreateBody(bd); RHand.CreateShape(def.RHandPoly); RHand.SetMassFromShapes(); // link body parts def.LAnkleDef.Body1 = LFoot; def.LAnkleDef.Body2 = LCalf; def.RAnkleDef.Body1 = RFoot; def.RAnkleDef.Body2 = RCalf; def.LKneeDef.Body1 = LCalf; def.LKneeDef.Body2 = LThigh; def.RKneeDef.Body1 = RCalf; def.RKneeDef.Body2 = RThigh; def.LHipDef.Body1 = LThigh; def.LHipDef.Body2 = Pelvis; def.RHipDef.Body1 = RThigh; def.RHipDef.Body2 = Pelvis; def.LowerAbsDef.Body1 = Pelvis; def.LowerAbsDef.Body2 = Stomach; def.UpperAbsDef.Body1 = Stomach; def.UpperAbsDef.Body2 = Chest; def.LowerNeckDef.Body1 = Chest; def.LowerNeckDef.Body2 = Neck; def.UpperNeckDef.Body1 = Chest; def.UpperNeckDef.Body2 = Head; def.LShoulderDef.Body1 = Chest; def.LShoulderDef.Body2 = LUpperArm; def.RShoulderDef.Body1 = Chest; def.RShoulderDef.Body2 = RUpperArm; def.LElbowDef.Body1 = LForearm; def.LElbowDef.Body2 = LUpperArm; def.RElbowDef.Body1 = RForearm; def.RElbowDef.Body2 = RUpperArm; def.LWristDef.Body1 = LHand; def.LWristDef.Body2 = LForearm; def.RWristDef.Body1 = RHand; def.RWristDef.Body2 = RForearm; // create joints LAnkle = (RevoluteJoint)w.CreateJoint(def.LAnkleDef); RAnkle = (RevoluteJoint)w.CreateJoint(def.RAnkleDef); LKnee = (RevoluteJoint)w.CreateJoint(def.LKneeDef); RKnee = (RevoluteJoint)w.CreateJoint(def.RKneeDef); LHip = (RevoluteJoint)w.CreateJoint(def.LHipDef); RHip = (RevoluteJoint)w.CreateJoint(def.RHipDef); LowerAbs = (RevoluteJoint)w.CreateJoint(def.LowerAbsDef); UpperAbs = (RevoluteJoint)w.CreateJoint(def.UpperAbsDef); LowerNeck = (RevoluteJoint)w.CreateJoint(def.LowerNeckDef); UpperNeck = (RevoluteJoint)w.CreateJoint(def.UpperNeckDef); LShoulder = (RevoluteJoint)w.CreateJoint(def.LShoulderDef); RShoulder = (RevoluteJoint)w.CreateJoint(def.RShoulderDef); LElbow = (RevoluteJoint)w.CreateJoint(def.LElbowDef); RElbow = (RevoluteJoint)w.CreateJoint(def.RElbowDef); LWrist = (RevoluteJoint)w.CreateJoint(def.LWristDef); RWrist = (RevoluteJoint)w.CreateJoint(def.RWristDef); }
//\this being here will save GC allocs // initialization void Awake() { _update_action = new UnityAction[] { utils.empty_action, update_act__disabled_control, update_act__control }; _spine = transform.Find("SpineM").GetComponent <Rigidbody2D>(); _spine_circle = _spine.GetComponent <CircleCollider2D>(); _spine_box = _spine.GetComponent <PolygonCollider2D>(); _spine_xform = _spine.transform; roll_grow_pos = roll_pos * roll_grow_speed / roll_radius; m_joints = new GymanJoint[13]; foreach (GymanJoint j in GetComponentsInChildren <GymanJoint>()) { if (j.gameObject.name == "LUArm") { m_joints[0] = j; } else if (j.gameObject.name == "LFArm") { m_joints[1] = j; } else if (j.gameObject.name == "RUArm") { m_joints[2] = j; } else if (j.gameObject.name == "RFArm") { m_joints[3] = j; } else if (j.gameObject.name == "Head") { m_joints[4] = j; } else if (j.gameObject.name == "SpineU") { m_joints[5] = j; } else if (j.gameObject.name == "SpineD") { m_joints[6] = j; } else if (j.gameObject.name == "LThigh") { m_joints[7] = j; } else if (j.gameObject.name == "LCalf") { m_joints[8] = j; } else if (j.gameObject.name == "LFoot") { m_joints[9] = j; } else if (j.gameObject.name == "RThigh") { m_joints[10] = j; } else if (j.gameObject.name == "RCalf") { m_joints[11] = j; } else if (j.gameObject.name == "RFoot") { m_joints[12] = j; } } m_grab_left = LFArm.GetComponent <GymanGrab>(); m_grab_right = RFArm.GetComponent <GymanGrab>(); m_foots = new GymanFoot[4]; m_foots[0] = LFoot.GetComponent <GymanFoot>(); m_foots[1] = RFoot.GetComponent <GymanFoot>(); refresh_update_num(); body_relax(); is_user_input = true; _current_magic_max_speed = magic_max_speed; }