public void setPower(GameObject joint) { JoinForce jf = joint.GetComponent <JoinForce>(); GameMainScreen.Power = (int)jf.P_FinalVelocity; Debug.Log("Collided:" + GameMainScreen.Power.ToString()); float [] FV = jf.FinalVelocities.ToArray(); int length = jf.FinalVelocities.Count; GameMainScreen.Power = (int)jf.sum / length; GameData.Current.NextPower(GameMainScreen.Power); //setPowerText(); }
private void OnCollisionEnter(Collision collision) { if (MP != null && MP.CanWork) { if (MP.CurrentJoint != null && MP.CurrentPunchBag != null) { GameObject JointObj = collision.collider.gameObject; if (MP.CurrentPunchBag.Equals(gameObject) && JointObj.CompareTag(MP.SkelCharJointMap[MP.CurrentJoint])) { //Debug.Log(collision.gameObject + "-" + collision.collider.gameObject.name + "-" + collision.contacts + "-" + "-" + collision.impulse + "-" + collision.relativeVelocity + "-" + collision.transform + "-" + collision.rigidbody); JoinForce JF = JointObj.GetComponent <JoinForce>(); float[] FV = JF.FinalVelocities.ToArray(); MP.GameMainScreen.Power = (int)JF.sum / FV.Length; MP.GameMainScreen.Score += 5; MP.isAccuracy = false; MP.isPower = true; MP.Map(); } } } }