using UnityEngine;
using System.Collections;
public class OnBtnClickState : MonoBehaviour
{
BoxCollider box;
Vector3 p;
void Start()
{
box = gameObject.GetComponent<BoxCollider>();
p = box.size;
UIEventListener.Get(gameObject).onPress += OnBtnPress;
}
void OnBtnPress(GameObject obj, bool state)
{
if (state)
{
TweenScale.Begin(gameObject, 0.1f, new Vector3(0.8f, 0.8f, 0.8f));
box.size = new Vector3(p.x * 1.4f, p.y * 1.4f, p.z * 1.4f);
}
else
{
TweenScale.Begin(gameObject, 0.1f, Vector3.one);
box.size = p;
}
}
}
按钮点击状态
最新推荐文章于 2024-06-08 07:20:27 发布