private void CheckHit() { //if (_checkPunch == 1) //{ // var Signx = Mathf.Sign(this.transform.localScale.x); // // var auxhits = defhits; // LastKick = fighterstate.ToString(); // switch (fighterstate) // { // case FighterStates.Lpunch: // //cast ray // //shoulders.x = Mathf.Abs(shoulders.x) * Signx; // // var armsizeaux = new Vector3(armsize.x * Signx, armsize.y, armsize.z); // var direction = armsizeaux - shoulders; // auxhits = Physics2D.RaycastAll(this.transform.position + shoulders, armsizeaux, direction.magnitude, LayerMask.GetMask("Enemy")); // // break; // // case FighterStates.Lmkick: // //cast ray // //legsize.x = Mathf.Abs(legsize.x) * Signx; // var legsizeaux = new Vector3(legsize.x * Signx, legsize.y, legsize.z); // direction = legsizeaux;//(this.transform.position+ legsizeaux) - this.transform.position; // auxhits = Physics2D.RaycastAll(this.transform.position, direction, direction.magnitude, LayerMask.GetMask("Enemy")); // break; // } // // // if (auxhits.Length>0) // { // infoHits = auxhits; // _checkPunch += 0.1f; // } //} var hitsresult = currentHit.CheckHit(); if (hitsresult.Length > 0) { infoHits = hitsresult; datekick = DateTime.Now; } }