• 大小: 2.59MB
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-08-13
  • 语言: 其他
  • 标签: unity3D  

资源简介

漂亮实用的传送门粒子特效,高端大气上档次,简单实用有内涵。

资源截图

代码片段和文件信息

using System.Collections;
using System.Collections.Generic;
using System.Runtime.Serialization.Formatters;
using System;
using UnityEngine;

public class CameraHolder : MonoBehaviour
{
    //camera holder
    public Transform Holder;
    public float currDistance = 5.0f;
    public float xRotate = 250.0f;
    public float yRotate = 120.0f;
    public float yMinLimit = -20f;
    public float yMaxLimit = 80f;
    public float prevDistance;
    private float x = 0.0f;
    private float y = 0.0f;
    //GUI


    void Start ()
    {

        var angles = transform.eulerAngles;
        x = angles.y;
        y = angles.x;
    }



    void LateUpdate ()
    {
        if (currDistance < 2)
        {
            currDistance = 2;
        }
        currDistance -= Input.GetAxis(“Mouse ScrollWheel“) * 20;
        if (Holder && (Input.GetMouseButton(0) || Input.GetMouseButton(1)))
        {
            var pos = Input.mousePosition;
            float dpiScale = 1;
            if (Screen.dpi < 1) dpiScale = 1;
            if (Screen.dpi < 200) dpiScale = 1;
            else dpiScale = Screen.dpi / 200f;  
            if (pos.x < 380 * dpiScale && Screen.height - pos.y < 250 * dpiScale) return;
            Cursor.visible = false;
            Cursor.lockState = CursorLockMode.Locked;
            x += (float)(Input.GetAxis(“Mouse X“) * xRotate * 0.02);
            y -= (float)(Input.GetAxis(“Mouse Y“) * yRotate * 0.02);
            y = ClampAngle(y yMinLimit yMaxLimit);
            var rotation = Quaternion.Euler(y x 0);
            var position = rotation * new Vector3(0 0 -currDistance) + Holder.position;
            transform.rotation = rotation;
            transform.position = position;
        }
        else
        {
            Cursor.visible = true;
            Cursor.lockState = CursorLockMode.None;
        }

        if (prevDistance != currDistance)
        {
            prevDistance = currDistance;
            var rot = Quaternion.Euler(y x 0);
            var po = rot * new Vector3(0 0 -currDistance) + Holder.position;
            transform.rotation = rot;
            transform.position = po;
        }
    }

    static float ClampAngle(float angle float min float max)
    {
        if (angle < -360)
        {
            angle += 360;
        }
        if (angle > 360)
        {
            angle -= 360;
        }
        return Mathf.Clamp(angle min max);
    }
}

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2018-06-06 10:18  TeleportEffect\
     目录           0  2018-06-06 10:18  TeleportEffect\Portal Particle\
     目录           0  2018-06-06 10:18  TeleportEffect\Portal Particle\Materials\
     文件         215  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials.meta
     文件        2277  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Background.mat
     文件         225  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Background.mat.meta
     文件        2148  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_1.mat
     文件         181  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_1.mat.meta
     文件        2149  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_10.mat
     文件         181  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_10.mat.meta
     文件        2141  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_11.mat
     文件         231  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_11.mat.meta
     文件        2149  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_12.mat
     文件         181  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_12.mat.meta
     文件        2124  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_13.mat
     文件         231  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_13.mat.meta
     文件        2122  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_14.mat
     文件         231  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_14.mat.meta
     文件        2137  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_15.mat
     文件         181  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_15.mat.meta
     文件        2140  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_16.mat
     文件         231  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_16.mat.meta
     文件         785  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_17.mat
     文件         181  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_17.mat.meta
     文件        2140  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_18.mat
     文件         231  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_18.mat.meta
     文件         769  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_19.mat
     文件         181  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_19.mat.meta
     文件        2130  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_2.mat
     文件         181  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_2.mat.meta
     文件        2143  2018-04-24 20:54  TeleportEffect\Portal Particle\Materials\Circle_20.mat
............此处省略203个文件信息

评论

共有 条评论