Files
Magical-Jumping-Bean/Library/metadata/f6/f603edd7163537f44927ad2808147a25
T

154 lines
12 KiB
Plaintext
Raw Normal View History

2019-09-29 19:40:54 -04:00
í/<2019.2.3f1þÿÿÿÿÿ’3$øÌuñ옲e+ Í=^7€ÿÿÿÿ¦€²Ð¦¦¦€#¦€+H€3ÿÿÿÿ1€1€ÿÿÿÿ@Þ Q€j
H€<ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jÕ€Iÿÿÿÿ1€1€ÿÿÿÿÀÞH€j€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€j€PAssetMetaDataguiddata[0]data[1]data[2]data[3]pathNameoriginalNamelabelsassetStoreRef ÿÿfš†!ë5˜9Ý4QÁóBí7€ÿÿÿÿ¦€²
E Þ€#.€,5a Þ€#.€,€r Þ€# .€,
H€«€ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jñ€JÿÿÿÿÀ1€1€ÿÿÿÿÞ€j€ÿÿÿÿ\€ÿÿÿÿH€rÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jH€wÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jH€€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jy
 Þ€#!.€,"€…ÿÿÿÿ#@1€1€ÿÿÿÿ$Þ%.€j&Õ€“ÿÿÿÿ'1€1€ÿÿÿÿ(ÀÞ)€j€ÿÿÿÿ*H€›€ÿÿÿÿ+1€1€ÿÿÿÿ,@Þ-Q€j.y
 /Þ€#0.€,1 €§2@¾€¶ 3@Þ€#4.€,5H€»ÿÿÿÿ61€1€ÿÿÿÿ7@Þ8Q€j9H€Æÿÿÿÿ:1€1€ÿÿÿÿ;@Þ<Q€j=H€Øÿÿÿÿ>1€1€ÿÿÿÿ?@Þ@Q€jAMonoImporterPPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_ExternalObjectsSourceAssetIdentifiertypeassemblynamem_UsedFileIDsm_DefaultReferencesexecutionOrdericonm_UserDatam_AssetBundleNamem_AssetBundleVariantsÿÿ£Gñ×ÜZ56 :!@iÁJ*€7€ÿÿÿÿ¦€²E Þ.(a Þ.€r Þ .
H€«€ÿÿÿÿ 1€1€ÿÿÿÿ @Þ
Q€jH€ê€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jñ€=ÿÿÿÿ1€1€ÿÿÿÿÞ€j€ÿÿÿÿH€›€ÿÿÿÿ1€1€ÿÿÿÿ@ÞQ€jy
 Þ.y€Q Þ. Þ€X!H€iÿÿÿÿ"1€1€ÿÿÿÿ#@Þ$Q€j%H€uÿÿÿÿ&1€1€ÿÿÿÿ'@Þ(Q€j)PPtr<EditorExtension>m_FileIDm_PathIDPPtr<PrefabInstance>m_DefaultReferencesm_Iconm_ExecutionOrderm_ClassNamem_Namespacepp\ày¯Ð\o0Þ}aSsO”rÚ‚€A§RHPackages/com.unity.timeline/Runtime/Playables/ParticleControlPlayable.csày¯ParticleControlPlayableÊusing System;
using UnityEngine.Playables;
namespace UnityEngine.Timeline
{
/// <summary>
/// Playable that synchronizes a particle system simulation.
/// </summary>
public class ParticleControlPlayable : PlayableBehaviour
{
const float kUnsetTime = -1;
float m_LastTime = kUnsetTime;
uint m_RandomSeed = 1;
// particleSystem.time can not be relied on for an accurate time. It does not advance until a delta threshold is reached(fixedUpdate) and until the start delay has elapsed.
float m_SystemTime;
/// <summary>
/// Creates a Playable with a ParticleControlPlayable behaviour attached
/// </summary>
/// <param name="graph">The PlayableGraph to inject the Playable into.</param>
/// <param name="component">The particle systtem to control</param>
/// <param name="randomSeed">A random seed to use for particle simulation</param>
/// <returns>Returns the created Playable.</returns>
public static ScriptPlayable<ParticleControlPlayable> Create(PlayableGraph graph, ParticleSystem component, uint randomSeed)
{
if (component == null)
return ScriptPlayable<ParticleControlPlayable>.Null;
var handle = ScriptPlayable<ParticleControlPlayable>.Create(graph);
handle.GetBehaviour().Initialize(component, randomSeed);
return handle;
}
/// <summary>
/// The particle system to control
/// </summary>
public ParticleSystem particleSystem { get; private set; }
/// <summary>
/// Initializes the behaviour with a particle system and random seed.
/// </summary>
/// <param name="ps"></param>
/// <param name="randomSeed"></param>
public void Initialize(ParticleSystem ps, uint randomSeed)
{
m_RandomSeed = Math.Max(1, randomSeed);
particleSystem = ps;
m_SystemTime = 0;
SetRandomSeed();
}
void SetRandomSeed()
{
particleSystem.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
var systems = particleSystem.gameObject.GetComponentsInChildren<ParticleSystem>();
uint seed = m_RandomSeed;
foreach (var ps in systems)
{
// don't overwrite user set random seeds
if (ps.useAutoRandomSeed)
{
ps.useAutoRandomSeed = false;
ps.randomSeed = seed;
seed++;
}
}
}
/// <summary>
/// This function is called during the PrepareFrame phase of the PlayableGraph.
/// </summary>
/// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
/// <param name="data">A FrameData structure that contains information about the current frame context.</param>
public override void PrepareFrame(Playable playable, FrameData data)
{
if (particleSystem == null || !particleSystem.gameObject.activeInHierarchy)
return;
float localTime = (float)playable.GetTime();
bool shouldUpdate = Mathf.Approximately(m_LastTime, kUnsetTime) ||
!Mathf.Approximately(m_LastTime, localTime);
if (shouldUpdate)
{
float epsilon = Time.fixedDeltaTime * 0.5f;
float simTime = localTime;
float expectedDelta = simTime - m_LastTime;
// The first iteration includes the start delay. Evaluate(particleSystem.randomSeed) is how the particle system generates the random value internally.
float startDelay = particleSystem.main.startDelay.Evaluate(particleSystem.randomSeed);
float particleSystemDurationLoop0 = particleSystem.main.duration + startDelay;
// The particle system time does not include the start delay so we need to remove this for our own system time.
float expectedSystemTime = simTime > particleSystemDurationLoop0 ? m_SystemTime : m_SystemTime - startDelay;
// conditions for restart
bool restart = (simTime < m_LastTime) || // time went backwards
(simTime < epsilon) || // time is set to 0
Mathf.Approximately(m_LastTime, kUnsetTime) || // object disabled
(expectedDelta > particleSystem.main.duration) || // large jump (bug workaround)
!(Mathf.Abs(expectedSystemTime - particleSystem.time) < Time.maximumParticleDeltaTime); // particle system isn't where we left it
if (restart)
{
// work around for a bug where simulate(simTime, true, true) doesn't work on loops
particleSystem.Simulate(0, true, true);
particleSystem.Simulate(simTime, true, false);
m_SystemTime = simTime;
}
else
{
// ps.time will wrap, so we need to account for that in computing delta time
float particleSystemDuration = simTime > particleSystemDurationLoop0 ? particleSystem.main.duration : particleSystemDurationLoop0;
float fracTime = simTime % particleSystemDuration;
float deltaTime = fracTime - m_SystemTime;
if (deltaTime < -epsilon) // detect wrapping of ps.time
deltaTime = fracTime + particleSystemDurationLoop0 - m_SystemTime;
particleSystem.Simulate(deltaTime, true, false);
m_SystemTime += deltaTime;
}
m_LastTime = localTime;
}
}
/// <summary>
/// This function is called when the Playable play state is changed to Playables.PlayState.Playing.
/// </summary>
/// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
/// <param name="info">A FrameData structure that contains information about the current frame context.</param>
public override void OnBehaviourPlay(Playable playable, FrameData info)
{
m_LastTime = kUnsetTime;
}
/// <summary>
/// This function is called when the Playable play state is changed to PlayState.Paused.
/// </summary>
/// <param name="playable">The playable this behaviour is attached to.</param>
/// <param name="info">A FrameData structure that contains information about the current frame context.</param>
public override void OnBehaviourPause(Playable playable, FrameData info)
{
m_LastTime = kUnsetTime;