unity中EventTrigger组件的应用

本文介绍了一个使用Unity实现的带有动画效果的左侧菜单栏,该菜单栏通过EventTrigger响应鼠标进入和离开事件,并利用DOTween插件平滑地改变菜单的位置。
using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using DG.Tweening;
using UnityEngine.Events;
using UnityEngine.EventSystems;

public class LeftMenuBarEvent
{
    private static LeftMenuBarEvent leftMenuBar_this;

    //private LeftMenuBarEvent()
    //{
    //}
    public static LeftMenuBarEvent Instance()
    {
        if (leftMenuBar_this == null)
        {
            leftMenuBar_this = new LeftMenuBarEvent();
        }
        return leftMenuBar_this;
    }


    private bool m_state = true;
    private EventTrigger m_eventTrigger;
    public GameObject PanelName;
    public void StartInit(GameObject Obj)
    {
        Obj.transform.Find("LeftBarPanel/menu/_right").gameObject.SetActive(true);
        Obj.transform.Find("LeftBarPanel/menu/_left").gameObject.SetActive(false);
    }


    publ
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值