DNP_CursorHint.cs 603 B

123456789101112131415161718192021222324252627
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. namespace DamageNumbersPro.Demo
  5. {
  6. public class DNP_CursorHint : MonoBehaviour
  7. {
  8. CanvasGroup cg;
  9. void Start()
  10. {
  11. cg = GetComponent<CanvasGroup>();
  12. }
  13. void FixedUpdate()
  14. {
  15. if(Cursor.visible)
  16. {
  17. cg.alpha = Mathf.Max(cg.alpha - Time.deltaTime * 2f, 0);
  18. }else
  19. {
  20. cg.alpha = Mathf.Min(cg.alpha + Time.deltaTime * 2f, 1);
  21. }
  22. }
  23. }
  24. }