protected override void ReadFromImpl(object obj)
 {
     base.ReadFromImpl(obj);
     ParticleSystem.TextureSheetAnimationModule uo = (ParticleSystem.TextureSheetAnimationModule)obj;
     enabled                 = uo.enabled;
     mode                    = uo.mode;
     numTilesX               = uo.numTilesX;
     numTilesY               = uo.numTilesY;
     animation               = uo.animation;
     frameOverTime           = uo.frameOverTime;
     frameOverTimeMultiplier = uo.frameOverTimeMultiplier;
     startFrame              = uo.startFrame;
     startFrameMultiplier    = uo.startFrameMultiplier;
     cycleCount              = uo.cycleCount;
     rowIndex                = uo.rowIndex;
     uvChannelMask           = uo.uvChannelMask;
     timeMode                = uo.timeMode;
     fps        = uo.fps;
     speedRange = uo.speedRange;
     rowMode    = uo.rowMode;
 }
Пример #2
0
        override public void OnInspectorGUI(InitialModuleUI initial)
        {
            int mode = GUIPopup(s_Texts.mode, m_Mode, s_Texts.modes);

            if (!m_Mode.hasMultipleDifferentValues)
            {
                if (mode == (int)ParticleSystemAnimationMode.Grid)
                {
                    GUIIntDraggableX2(s_Texts.tiles, s_Texts.tilesX, m_TilesX, s_Texts.tilesY, m_TilesY);

                    int type = GUIPopup(s_Texts.animation, m_AnimationType, s_Texts.types);
                    if (type == (int)ParticleSystemAnimationType.SingleRow)
                    {
                        GUIPopup(s_Texts.rowMode, m_RowMode, s_Texts.rowModes);
                        if (!m_RowMode.hasMultipleDifferentValues && m_RowMode.intValue == (int)ParticleSystemAnimationRowMode.Custom)
                        {
                            GUIInt(s_Texts.row, m_RowIndex);
                        }

                        m_FrameOverTime.m_RemapValue = (float)(m_TilesX.intValue);
                        m_StartFrame.m_RemapValue    = (float)(m_TilesX.intValue);
                    }
                    else
                    {
                        m_FrameOverTime.m_RemapValue = (float)(m_TilesX.intValue * m_TilesY.intValue);
                        m_StartFrame.m_RemapValue    = (float)(m_TilesX.intValue * m_TilesY.intValue);
                    }
                }
                else
                {
                    DoListOfSpritesGUI();
                    ValidateSpriteList();

                    m_FrameOverTime.m_RemapValue = (float)(m_Sprites.arraySize);
                    m_StartFrame.m_RemapValue    = (float)(m_Sprites.arraySize);
                }
            }

            ParticleSystemAnimationTimeMode timeMode = (ParticleSystemAnimationTimeMode)GUIPopup(s_Texts.timeMode, m_TimeMode, s_Texts.timeModes);

            if (!m_TimeMode.hasMultipleDifferentValues)
            {
                if (timeMode == ParticleSystemAnimationTimeMode.FPS)
                {
                    GUIFloat(s_Texts.fps, m_FPS);
                    foreach (ParticleSystem ps in m_ParticleSystemUI.m_ParticleSystems)
                    {
                        if (ps.main.startLifetimeMultiplier == Mathf.Infinity)
                        {
                            EditorGUILayout.HelpBox("FPS mode does not work when using infinite particle lifetimes.", MessageType.Error, true);
                            break;
                        }
                    }
                }
                else if (timeMode == ParticleSystemAnimationTimeMode.Speed)
                {
                    GUIMinMaxRange(s_Texts.speedRange, m_SpeedRange);
                }
                else
                {
                    GUIMinMaxCurve(s_Texts.frameOverTime, m_FrameOverTime);
                }
            }
            GUIMinMaxCurve(s_Texts.startFrame, m_StartFrame);

            if (!m_TimeMode.hasMultipleDifferentValues && timeMode != ParticleSystemAnimationTimeMode.FPS)
            {
                GUIFloat(s_Texts.cycles, m_Cycles);
            }
            GUIEnumMaskUVChannelFlags(s_Texts.uvChannelMask, m_UVChannelMask);
        }