• 大小: 48.83M
    文件类型: .zip
    金币: 1
    下载: 0 次
    发布日期: 2023-07-10
  • 语言: 其他
  • 标签: 其他  

资源简介

DaLianZhiYiKeJi-roomgame-master.zip

资源截图

代码片段和文件信息

//This script will only work in editor mode. You cannot adjust the scale dynamically in-game!

using UnityEngine;
using UnityEditor;
#if UNITY_EDITOR

#endif

namespace Assets.scripts.Common.Utils
{
    [ExecuteInEditMode]
    public class ParticleScaler : MonoBehaviour 
    {
        public float particleScale = 1.0f;
        public bool alsoScaleGameobject = true;

        float prevScale;

        void Start()
        {
            prevScale = particleScale;
        }

        void Update () 
        {
#if UNITY_EDITOR 
    //check if we need to update
if (prevScale != particleScale && particleScale > 0)
{
if (alsoScaleGameobject)
transform.localScale = new Vector3(particleScale particleScale particleScale);

float scaleFactor = particleScale / prevScale;

//scale legacy particle systems
ScaleLegacySystems(scaleFactor);

//scale shuriken particle systems
ScaleShurikenSystems(scaleFactor);

//scale trail renders
ScaleTrailRenderers(scaleFactor);

prevScale = particleScale;
}
#endif
        }

        void ScaleShurikenSystems(float scaleFactor)
        {
#if UNITY_EDITOR 
    //get all shuriken systems we need to do scaling on
ParticleSystem[] systems = GetComponentsInChildren();

foreach (ParticleSystem system in systems)
{
system.startSpeed *= scaleFactor;
system.startSize *= scaleFactor;
system.gravityModifier *= scaleFactor;

Serializedobject so = new Serializedobject(system);
so.FindProperty(“VelocityModule.x.scalar“).floatValue *= scaleFactor;
so.FindProperty(“VelocityModule.y.scalar“).floatValue *= scaleFactor;
so.FindProperty(“VelocityModule.z.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ClampVelocityModule.magnitude.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ClampVelocityModule.x.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ClampVelocityModule.y.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ClampVelocityModule.z.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ForceModule.x.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ForceModule.y.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ForceModule.z.scalar“).floatValue *= scaleFactor;
so.FindProperty(“ColorBySpeedModule.range“).vector2Value *= scaleFactor;
so.FindProperty(“SizeBySpeedModule.range“).vector2Value *= scaleFactor;
so.FindProperty(“RotationBySpeedModule.range“).vector2Value *= scaleFactor;
so.ApplyModifiedProperties();
}
#endif
        }

        void ScaleLegacySystems(float scaleFactor)
        {
#if UNITY_EDITOR 
    //get all emitters we need to do scaling on
ParticleEmitter[] emitters = GetComponentsInChildren();

//get all animators we need to do scaling on
ParticleAnimator[] animators = GetComponentsInChildren();

//apply scaling to emitters
foreach (ParticleEmitter emitter in emitters)
{
emitter.minSize *= scaleFactor;
emitter.maxSize *= scaleFactor;
emi

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----
     目录           0  2019-06-26 10:15  roomgame\
     文件       89133  2019-06-26 10:15  roomgame\.gitignore
     目录           0  2019-06-26 10:15  roomgame\Assets\
     文件         191  2019-06-26 10:15  roomgame\Assets\AutoFile.meta
     目录           0  2019-06-26 10:15  roomgame\Assets\AutoFile\
     文件        2848  2019-06-26 10:15  roomgame\Assets\AutoFile\DefualtIcon.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\DefualtIcon.png.meta
     文件         191  2019-06-26 10:15  roomgame\Assets\AutoFile\Icons.meta
     文件         191  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages.meta
     目录           0  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_0.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_0.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_1.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_1.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_2.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_2.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_3.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_3.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_4.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_4.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_5.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_5.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_6.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_6.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_7.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_7.png.meta
     文件          70  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_8.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImages\SplashImg_8.png.meta
     文件        2848  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImg.png
     文件        1261  2019-06-26 10:15  roomgame\Assets\AutoFile\SplashImg.png.meta
     文件         191  2019-06-26 10:15  roomgame\Assets\AutoFile\ziptemp.meta
............此处省略3140个文件信息

评论

共有 条评论