void Attack() { //GameObject handContainer = GameObject.Find ("PepperLightFullRightHand(Clone)/HandContainer") as GameObject; handContainer = GameObject.Find("RigidRoundHand(Clone)/forearm") as GameObject; //palm,forearm if (handContainer) { hx = handContainer.transform.position.x; hy = handContainer.transform.position.y; //maxX = Mathf.Min(maxX, hx); maxY = Mathf.Max(maxY, hy); if (maxY - hy < 0.1f && maxY - hy > 0.05f) { //Debug.Log(maxY - hy); knightControl.Attack(0); maxY = hy; } } else { maxX = 10000f; maxY = 0f; } }