提交捏脸插件
This commit is contained in:
43
Assets/CharacterCustomizer/UI/Scripts/Cursor_Manager.cs
Normal file
43
Assets/CharacterCustomizer/UI/Scripts/Cursor_Manager.cs
Normal file
@@ -0,0 +1,43 @@
|
||||
using UnityEngine;
|
||||
|
||||
namespace CC
|
||||
{
|
||||
public class Cursor_Manager : MonoBehaviour
|
||||
{
|
||||
public static Cursor_Manager instance;
|
||||
|
||||
public Texture2D cursorTexture;
|
||||
private Vector2 hotSpot = new Vector2(0, 0);
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (instance == null)
|
||||
{
|
||||
instance = this;
|
||||
}
|
||||
else
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
if (cursorTexture != null)
|
||||
{
|
||||
hotSpot = new Vector2(cursorTexture.width / 2, cursorTexture.height / 2);
|
||||
setDefaultCursor();
|
||||
}
|
||||
}
|
||||
|
||||
public void setCursor(Texture2D texture)
|
||||
{
|
||||
if (cursorTexture != null)
|
||||
{
|
||||
Cursor.SetCursor(texture, hotSpot, CursorMode.Auto);
|
||||
}
|
||||
}
|
||||
|
||||
public void setDefaultCursor()
|
||||
{
|
||||
setCursor(cursorTexture);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user