-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Replaced ParticleMaster with the new LiveParticleEditor
- Made alpha slider easier to understand - Made SyncLinearKey a seperate class to avoid confusion - Updated ReadMe - Minor Text Fixes
- Loading branch information
1 parent
daad59e
commit 27a95af
Showing
5 changed files
with
95 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
using System; | ||
using BaseX; | ||
using FrooxEngine; | ||
using FrooxEngine.UIX; | ||
using CodeX; | ||
|
||
namespace ParticleWorkshop | ||
{ | ||
[Category("Gareth")] | ||
class LiveParticleEditor : Component, ICustomInspector | ||
{ | ||
public readonly SyncRef<ParticleStyle> ParticleStyle; | ||
public readonly SyncList<SyncLinearKey<color>> Colors; | ||
public readonly SyncList<SyncLinearKey<float>> Alpha; | ||
|
||
//Ui is needed | ||
public void BuildInspectorUI(UIBuilder ui) | ||
{ | ||
WorkerInspector.BuildInspectorUI(this, ui); | ||
} | ||
protected override void OnAttach() | ||
{ | ||
if (ParticleStyle != null&&!ParticleStyle.IsDisposed) | ||
{ | ||
ParticleStyle.Changed += Update_Paticles; | ||
Colors.Changed += Colors_Changed; | ||
Alpha.Changed += Alpha_Changed; | ||
} | ||
base.OnAttach(); | ||
} | ||
private void Colors_Changed(IChangeable obj) | ||
{ | ||
ParticleStyle.Target.ColorOverLifetime.Clear(); | ||
foreach (SyncLinearKey<color> key in Colors) | ||
{ | ||
ParticleStyle.Target.ColorOverLifetime.Append(key); | ||
} | ||
} | ||
|
||
private void Alpha_Changed(IChangeable obj) | ||
{ | ||
ParticleStyle.Target.AlphaOverLifetime.Clear(); | ||
foreach (SyncLinearKey<float> key in Alpha) | ||
{ | ||
ParticleStyle.Target.AlphaOverLifetime.Append(key); | ||
} | ||
} | ||
|
||
private void Update_Paticles(IChangeable obj) | ||
{ | ||
ParticleStyle.Target.UseColorOverLifetime.Value = true; | ||
Colors_Changed(Colors); | ||
Alpha_Changed(Alpha); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
using BaseX; | ||
using FrooxEngine; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Text; | ||
|
||
namespace ParticleWorkshop | ||
{ | ||
public class SyncLinearKey<T> : SyncObject where T : IEquatable<T> | ||
{ | ||
[Range(0.0f, 1f, "0.000")] | ||
public readonly Sync<float> TransitionTime; | ||
[Range(0.0f, 1f, "0.00")] | ||
public readonly Sync<T> Value; | ||
public static implicit operator LinearKey<T>(SyncLinearKey<T> key) => new LinearKey<T>(key.TransitionTime.Value, key.Value.Value); | ||
} | ||
} |