1
This commit is contained in:
@@ -0,0 +1,38 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UnityEngine.iOS;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace BITKit.UX
|
||||
{
|
||||
public class UXTranslucentService : MonoBehaviour
|
||||
{
|
||||
[SerializeField] private Image image;
|
||||
private float alpha;
|
||||
private void Start()
|
||||
{
|
||||
BITAppForUnity.AllowCursor.AddListener(OnCursor);
|
||||
destroyCancellationToken.Register(Dispose);
|
||||
}
|
||||
private void Dispose()
|
||||
{
|
||||
BITAppForUnity.AllowCursor.RemoveListener(OnCursor);
|
||||
}
|
||||
private void OnCursor(bool obj)
|
||||
{
|
||||
image.enabled = obj;
|
||||
if (obj) alpha = 0;
|
||||
}
|
||||
private void Update()
|
||||
{
|
||||
if (BITAppForUnity.AllowCursor.Allow && alpha is not 1)
|
||||
{
|
||||
alpha = Mathf.Clamp01(alpha + Time.deltaTime*5);
|
||||
image.color = new Color(0, 0, 0, alpha);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
Reference in New Issue
Block a user