Unity3D学习 愤怒的小鸟之关卡选择界面(六)

来源:互联网 发布:查看企业信息的软件 编辑:程序博客网 时间:2024/05/22 08:25

目标:实现关卡选择界面



这一篇里没有新的内容,全是前面5讲知识点的综合,如何用GUITexture做背景,如何用GUISkin做个性化的按钮,如何添加游戏背景音乐,如何修改鼠标样式,这些都是前面提到的知识点,在这里大家用这个界面把之前的都巩固下吧。

#pragma strictvar customSkin : GUISkin;function Start () {}function Update () {}function OnGUI () {GUI.matrix = Matrix4x4.TRS(Vector3.zero, Quaternion.identity, Vector3(Screen.width / 800.0, Screen.height / 600.0, 1));GUI.skin = customSkin;if (GUI.Button(Rect(125, 100, 150, 150), "", "Level1")) {Application.LoadLevel(3);}if (GUI.Button(Rect(325, 100, 150, 150), "", "Level2")) {}if (GUI.Button(Rect(525, 100, 150, 150), "", "Level3")) {}if (GUI.Button(Rect(125, 300, 150, 150), "", "Level4")) {}if (GUI.Button(Rect(325, 300, 150, 150), "", "Level5")) {}if (GUI.Button(Rect(525, 300, 150, 150), "", "Level6")) {}if (GUI.Button(Rect(70, 500, 100, 80), "", "Back")) {Application.LoadLevel(1);}}

OK,运行下试试吧!


源码下载地址: http://download.csdn.net/detail/ariel7321/4421702



原创粉丝点击