void OnGUI() { if(GUILayout.RepeatButton("加血")) { if(HP<100) { HP++; } } if(GUILayout.RepeatButton("减血")) { if(HP>0) { HP--; } } int blood_width=blood_Red.width * HP/100; GUI.DrawTexture(new Rect(100,100,blood_Black.width,blood_Black.height),blood_Black); GUI.DrawTexture(new Rect(100,100,blood_width,blood_Red.height),blood_Red); }
时间: 2024-11-08 12:37:33