mirror of
https://github.com/FriendshipIsEpic/FiE-Game.git
synced 2024-11-23 22:27:58 +01:00
40 lines
966 B
C#
40 lines
966 B
C#
using Fie.Utility;
|
|
using UnityEngine;
|
|
|
|
namespace Fie.UI
|
|
{
|
|
public class FieSkillTreeSkillGroupButtonRoot : MonoBehaviour
|
|
{
|
|
private Tweener<TweenTypesInOutSine> _alphaTweener = new Tweener<TweenTypesInOutSine>();
|
|
|
|
private float currentDispalyingRate;
|
|
|
|
private Vector3 initializedLocalPosition = Vector3.zero;
|
|
|
|
private void Awake()
|
|
{
|
|
initializedLocalPosition = base.transform.localPosition;
|
|
}
|
|
|
|
public void Show()
|
|
{
|
|
_alphaTweener.InitTweener(1.5f, currentDispalyingRate, 1f);
|
|
}
|
|
|
|
public void Hide()
|
|
{
|
|
_alphaTweener.InitTweener(1.5f, currentDispalyingRate, 0f);
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
if (!_alphaTweener.IsEnd())
|
|
{
|
|
currentDispalyingRate = _alphaTweener.UpdateParameterFloat(Time.deltaTime);
|
|
Vector3 localPosition = initializedLocalPosition;
|
|
localPosition.x = initializedLocalPosition.x - (float)Screen.width * 0.5f * (1f - currentDispalyingRate);
|
|
base.transform.localPosition = localPosition;
|
|
}
|
|
}
|
|
}
|
|
}
|