-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
fdd2bcf
commit 57ead26
Showing
5 changed files
with
97 additions
and
32 deletions.
There are no files selected for viewing
16 changes: 14 additions & 2 deletions
16
SRXDCustomVisuals/SRXDCustomVisuals.Behaviors/ParticleEffectController.cs
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 |
---|---|---|
@@ -1,18 +1,30 @@ | ||
using SRXDCustomVisuals.Core; | ||
using System; | ||
using SRXDCustomVisuals.Core; | ||
using UnityEngine; | ||
|
||
namespace SRXDCustomVisuals.Behaviors; | ||
|
||
public class ParticleEffectController : VisualsController { | ||
[SerializeField] private ParticleSystem particleSystem; | ||
|
||
public override IVisualsEvent GetEvent(string key) => key switch { | ||
"Play" => new VisualsEvent(Play), | ||
"Stop" => new VisualsEvent(Stop), | ||
_ => null | ||
}; | ||
|
||
public override IVisualsProperty GetProperty(string key) => key switch { | ||
"EnableEmission" => new VisualsProperty(EnableEmissionChanged), | ||
_ => null | ||
}; | ||
|
||
private void Play(IVisualsParams parameters) => particleSystem.Play(); | ||
|
||
private void Stop(IVisualsParams parameters) => particleSystem.Stop(); | ||
|
||
private void EnableEmissionChanged(VisualsProperty property) { | ||
var emission = particleSystem.emission; | ||
|
||
emission.enabled = property.GetBool(); | ||
} | ||
} |
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