public class CursorManager : MonoBehaviour {
public static CursorManager _instance;
public Texture2D cursor_normal;
public Texture2D cursor_npc_talk;
public Texture2D cursor_attack;
public Texture2D cursor_lockTarget;
public Texture2D cursor_pick;
//指针的热点,默认为左上角
private Vector2 hotspot = Vector2.zero;
//指针的类型
private CursorMode mode = CursorMode.Auto;
void Start() {
_instance = this;
}
/// <summary>
/// 将光标设置为正常的指针
/// </summary>
public void SetNormal() {
Cursor.SetCursor(cursor_normal, hotspot, mode);
}
/// <summary>
/// 光标设置为和NPC聊天的指针
/// </summary>
public void SetNpcTalk() {
Cursor.SetCursor(cursor_npc_talk, hotspot, mode);
}
public void SetAttack() {
Cursor.SetCursor(cursor_attack, hotspot, mode);
}
/// <summary>
/// 锁定目标
/// </summary>
public void SetLockTarget() {
Cursor.SetCursor(cursor_lockTarget, hotspot, mode);
}
/// <summary>
/// 拾取物品
/// </summary>
public void SetPick()
{
Cursor.SetCursor(cursor_pick, hotspot, mode);
}
}