-
Notifications
You must be signed in to change notification settings - Fork 1
/
menu.cs
37 lines (29 loc) · 861 Bytes
/
menu.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using UnityEngine;
using System.Collections;
using UnityEngine.EventSystems;
using System;
public class menu : MonoBehaviour,IPointerEnterHandler,IPointerExitHandler {
public RectTransform tx;
public bool isopen;
// Use this for initialization
void Start () {
tx = transform.FindChild("tx").GetComponent<RectTransform>();
isopen = false;
}
// Update is called once per frame
void Update () {
Vector3 scole = tx.lossyScale;
scole.y = Mathf.Lerp(scole.y, isopen ? 1 : 0, Time.deltaTime *3000);
scole.x = 1;
scole.z = 1;
tx.localScale = scole;
}
public void OnPointerEnter(PointerEventData eventData)
{
isopen = true;
}
public void OnPointerExit(PointerEventData eventData)
{
isopen = false;
}
}