mirror of
https://github.com/DerTyp7/defrain-shooter-unity.git
synced 2025-10-29 12:52:07 +01:00
fixed hover bug
This commit is contained in:
@@ -16,6 +16,8 @@ public class HomeSceneBackBtnScript : MonoBehaviour, IPointerEnterHandler, IPoin
|
|||||||
float exitingTimePassed = 0.0f;
|
float exitingTimePassed = 0.0f;
|
||||||
|
|
||||||
bool isHovering = false;
|
bool isHovering = false;
|
||||||
|
bool preventHoverOnStartUp = true;
|
||||||
|
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
@@ -33,9 +35,9 @@ public class HomeSceneBackBtnScript : MonoBehaviour, IPointerEnterHandler, IPoin
|
|||||||
arrow1RectTransform.anchoredPosition = new Vector2(Mathf.Lerp(0, 15, hoveringTimePassed / hoverTransitionTime), arrow1RectTransform.anchoredPosition.y);
|
arrow1RectTransform.anchoredPosition = new Vector2(Mathf.Lerp(0, 15, hoveringTimePassed / hoverTransitionTime), arrow1RectTransform.anchoredPosition.y);
|
||||||
arrow2RectTransform.anchoredPosition = new Vector2(Mathf.Lerp(10, 30, hoveringTimePassed / hoverTransitionTime), arrow2RectTransform.anchoredPosition.y);
|
arrow2RectTransform.anchoredPosition = new Vector2(Mathf.Lerp(10, 30, hoveringTimePassed / hoverTransitionTime), arrow2RectTransform.anchoredPosition.y);
|
||||||
|
|
||||||
|
preventHoverOnStartUp = false;
|
||||||
}
|
}
|
||||||
else
|
else if(!preventHoverOnStartUp)
|
||||||
{
|
{
|
||||||
hoveringTimePassed = 0.0f;
|
hoveringTimePassed = 0.0f;
|
||||||
exitingTimePassed += Time.deltaTime;
|
exitingTimePassed += Time.deltaTime;
|
||||||
|
|||||||
@@ -15,6 +15,7 @@ public class HomeSceneBtnBigScript : MonoBehaviour, IPointerEnterHandler, IPoint
|
|||||||
float exitingTimePassed = 0.0f;
|
float exitingTimePassed = 0.0f;
|
||||||
|
|
||||||
bool isHovering = false;
|
bool isHovering = false;
|
||||||
|
bool preventHoverOnStartUp = true;
|
||||||
|
|
||||||
void Update()
|
void Update()
|
||||||
{
|
{
|
||||||
@@ -31,9 +32,9 @@ public class HomeSceneBtnBigScript : MonoBehaviour, IPointerEnterHandler, IPoint
|
|||||||
|
|
||||||
backgroundRectTranform.sizeDelta = new Vector2(Mathf.Lerp(0, rectTransform.rect.width, hoveringTimePassed / hoverTransitionTime), rectTransform.rect.height);
|
backgroundRectTranform.sizeDelta = new Vector2(Mathf.Lerp(0, rectTransform.rect.width, hoveringTimePassed / hoverTransitionTime), rectTransform.rect.height);
|
||||||
|
|
||||||
|
preventHoverOnStartUp = false;
|
||||||
}
|
}
|
||||||
else
|
else if(!preventHoverOnStartUp)
|
||||||
{
|
{
|
||||||
hoveringTimePassed = 0.0f;
|
hoveringTimePassed = 0.0f;
|
||||||
exitingTimePassed += Time.deltaTime;
|
exitingTimePassed += Time.deltaTime;
|
||||||
|
|||||||
Reference in New Issue
Block a user