• 大小: 2KB
    文件类型: .cs
    金币: 1
    下载: 0 次
    发布日期: 2021-05-13
  • 语言: C#
  • 标签: Unity  

资源简介

UI界面处理过渡 比如 点击开始游戏按钮 界面就滑动离开让其他界面上来

资源截图

代码片段和文件信息

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class SwitchClick : MonoBehaviour
{
    /// 
    /// 自身的坐标
    /// 

    private RectTransform _Rect;
    /// 
    /// 判断开启
    /// 

    private bool IsClick = false;
    /// 
    /// 左右判断
    /// 

    private bool ToOrOut = true;
    /// 
    /// 速度
    /// 

    private int Speed;
    /// 
    /// 距离
    /// 

    private int Distance;
    void Start()
    {
        Init();
    }


    void Update()
    {
        Click();
    }


    /// 
    /// 初始化
    /// 

    public void Init()
    {
        _Rect = transform.GetComponent();
        Speed = 50;
        Distance = 100;
    }


    /// 
    /// 进入
    /// 

    public void GetInto()///从右边到左边
    {
        _Rect.anchoredPosition = new Vector2(Distance 0);
        IsClick = true;
        ToOrOut = true;
    }

  

评论

共有 条评论