unity3d 帮助引导

/*	Author:AndySun
 * 	Time:2013/8/19
 * 	Function:Loader Help Image	
 * 	Version:003
 **/

using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(GUITexture))]
public class Loader : MonoBehaviour {
    [System.Serializable]
    public class Group {
        public Texture2D texture;//The Textures to show the Description of the UI button
        public Rect position;//The position of the UI button
    }

    public Group[] item;

	public Texture2D cursor;//The texture that change the cursor style
	
	//The count of the current image
	private static int count = 0;
	//The position of the mousebutton
	private Vector3 mousePosition;
	//The Level to be Loaded
	public int loadLevel = 1;
	
	void OnGUI(){
		guiTexture.texture = item[count].texture;//Change the help image
		
		//Show the button to change help image
		if(GUI.Button(item[count].position,"")){
			count++;
		}
		
		//If the help image is over,load the first level.
		if(count == item.Length){
			Application.LoadLevel(loadLevel);
		}
	}
	
	void Update(){
		mousePosition = Input.mousePosition;
		//If the mouse is on the rectangle
        if ((mousePosition.x > item[count].position.xMin) && ((Screen.height - mousePosition.y) > item[count].position.yMin) && (mousePosition.x < item[count].position.xMax) && ((Screen.height - mousePosition.y) < item[count].position.yMax))
        {
			Cursor.SetCursor(cursor,Vector2.zero,CursorMode.Auto);//Change the cursor
		}else
		{
			Cursor.SetCursor(null,Vector2.zero,CursorMode.Auto);//Set the cursor to default cursor
		}
	}
}

你可能感兴趣的:(Unity3D)