using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.EventSystems; using DG.Tweening; using System; namespace SC { public class LocalPositionEffect : PointEffectBase { /// /// 初始值 /// float initLocalPositionValue; /// /// 开始值 /// public float LocalPositionValue; protected override void Awake() { base.Awake(); initLocalPositionValue = transform.localPosition.z; } public override void OnPointerEnter(PointerEventData eventData) { base.OnPointerEnter(eventData); transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, LocalPositionValue); } public override void OnPointerExit(PointerEventData eventData) { base.OnPointerExit(eventData); transform.localPosition = new Vector3(transform.localPosition.x, transform.localPosition.y, initLocalPositionValue); } } }