void RepairItem() { if (health == 100) { if (desk != null && desk.myItem != null) { if ((playerNo == PlayerNo.player_1 && Input.GetKey(KeyCode.Joystick1Button1)) || (playerNo == PlayerNo.player_2 && (Input.GetKey(KeyCode.Joystick2Button1)) || Input.GetKeyDown(KeyCode.F))) { if (desk.myItem.types[desk.myItem.typeIndex] == desk.correctItemType) { if (desk.myItem.repairPercent < 100) { desk.myItem.repairPercent++; } else { if (desk.myItem.typeIndex < desk.myItem.types.Length - 1) { desk.myItem.repairPercent = 0; desk.myItem.typeIndex++; } else { desk.GetComponent <MeshRenderer>().material = GameManager.instance.greenMat; Destroy(desk.myItem.gameObject); } } } } } } }