【发布时间】:2015-04-23 15:19:19
【问题描述】:
我正在 Unity 中制作一个简单的 2D 游戏。 我有两个标签,一个显示当前分数,另一个显示高分。我可以在游戏运行时将这些标签从一个位置移动到另一个位置吗?我想要一个“跳入”效果。希望大家能帮忙。
public void ShowEndScore(Font font, float coins, int highscore)
{
GUIStyle style = new GUIStyle();
style.fontSize = 150;
style.fontStyle = FontStyle.Bold;
style.normal.textColor = Color.yellow;
style.alignment = TextAnchor.UpperCenter;
style.font = font;
GUI.Label (new Rect (Screen.width / 2 - 50, Screen.height / 2 - 50, 100, 50), "Your score: "+ coins, style);
GUI.Label (new Rect (Screen.width / 2 - 50, Screen.height / 2, 100, 50), "Highscore: "+ highscore, style);
}
【问题讨论】:
-
您尝试过什么来完成此任务,但没有成功?从您的代码中,我们只能收集到您创建了两个标签。
-
@EBrown 我还没有尝试过,因为我不知道如何 - 抱歉