forked from Unity-Technologies/UnityCsReference
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLifetimeByEmitterSpeedModuleUI.cs
More file actions
55 lines (46 loc) · 2 KB
/
Copy pathLifetimeByEmitterSpeedModuleUI.cs
File metadata and controls
55 lines (46 loc) · 2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
// Unity C# reference source
// Copyright (c) Unity Technologies. For terms of use, see
// https://unity3d.com/legal/licenses/Unity_Reference_Only_License
using UnityEngine;
namespace UnityEditor
{
class LifetimeByEmitterSpeedModuleUI : ModuleUI
{
// Keep in sync with LifetimeByEmitterSpeedModule.h
SerializedMinMaxCurve m_Curve;
SerializedProperty m_Range;
class Texts
{
public GUIContent speed = EditorGUIUtility.TrTextContent("Multiplier", "Controls the initial lifetime of particles based on the speed of the emitter.");
public GUIContent speedRange = EditorGUIUtility.TrTextContent("Speed Range", "Maps the speed to a value along the curve, when using one of the curve modes.");
}
static Texts s_Texts;
public LifetimeByEmitterSpeedModuleUI(ParticleSystemUI owner, SerializedObject o, string displayName)
: base(owner, o, "LifetimeByEmitterSpeedModule", displayName)
{
m_ToolTip = "Controls the initial lifetime of each particle based on the speed of the emitter when the particle was spawned.";
}
protected override void Init()
{
// Already initialized?
if (m_Curve != null)
return;
if (s_Texts == null)
s_Texts = new Texts();
m_Curve = new SerializedMinMaxCurve(this, GUIContent.none, "m_Curve");
m_Range = GetProperty("m_Range");
}
override public void OnInspectorGUI(InitialModuleUI initial)
{
GUIMinMaxCurve(s_Texts.speed, m_Curve);
GUIMinMaxRange(s_Texts.speedRange, m_Range);
}
override public void UpdateCullingSupportedString(ref string text)
{
Init();
string failureReason = string.Empty;
if (!m_Curve.SupportsProcedural(ref failureReason))
text += "\nLifetime By Emitter Speed module curve: " + failureReason;
}
}
} // namespace UnityEditor