Expand on vfx related codes

This commit is contained in:
Nico 2025-06-27 21:06:29 -07:00
parent f3a6315a65
commit 250048e3d2
10 changed files with 47 additions and 469 deletions

View File

@ -14,4 +14,4 @@ MonoBehaviour:
m_EditorClassIdentifier:
PrefabToSpawn: {fileID: 3569570202871523113, guid: bb6fb8e00f9331e4e8f33f5c2563ba8e, type: 3}
PrefabToSpawnPreviewAsset: {fileID: 3569570202871523113, guid: 997fb62ab3397bf4dbae538691a1d668, type: 3}
VfxExplosion: {fileID: 4566952472781634859, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
Sparkle: {fileID: 11400000, guid: 835827cc500c145458403d8ca0ebdd36, type: 2}

View File

@ -17,22 +17,20 @@ public class BuildHandler : ScriptableObject {
public GameObject PrefabToSpawnPreviewAsset;
[Header("VFX Dependencies")]
public GameObject VfxExplosion;
private GameObject VfxExplosionParentInstance;
private List<ParticleSystem> VfxExplosionParticles = new List<ParticleSystem>();
public VfxHandlerBase Sparkle;
private GameObject PreviewObj;
private Vector3 SnappedPosition;
private bool BuildMode = false;
private Vector2 SpriteSize;
private CapsuleDirection2D CapsuleDirection = CapsuleDirection2D.Vertical;
private bool Initialized = false;
void Awake() {
Debug.Log(PreviewObj.name);
private void OnEnable() {
InitializePreviewObj();
}
public void Initialize() {
private void InitializePreviewObj() {
PreviewObj = Instantiate(PrefabToSpawnPreviewAsset, new Vector3(), Quaternion.identity);
SpriteRenderer sprite = PreviewObj.GetComponent<SpriteRenderer>();
Sprite s = PreviewObj.GetComponent<SpriteRenderer>().sprite;
@ -40,30 +38,17 @@ public class BuildHandler : ScriptableObject {
SpriteSize = s.rect.size / s.pixelsPerUnit;
if (SpriteSize.x > SpriteSize.y)
CapsuleDirection = CapsuleDirection2D.Horizontal;
VfxExplosionParticles.Clear();
if (VfxExplosion) {
VfxExplosionParentInstance = Instantiate(VfxExplosion, Vector3.one, Quaternion.identity);
var foundParticleSystems = VfxExplosionParentInstance.GetComponentsInChildren<ParticleSystem>();
VfxExplosionParticles.AddRange(foundParticleSystems);
VfxExplosionParticles.ForEach((x) => x.transform.localScale = Vector3.one);
}
Initialized = true;
}
public void SetBuildMode(bool mode) {
//if (!PreviewObj)
// CreatePreviewObj();
if (PreviewObj == null) InitializePreviewObj();
PreviewObj.SetActive(mode);
BuildMode = mode;
if (mode) Debug.Log("BuildMode ON");
}
Vector3 GetSnappedPosition(Vector3 worldPos, float gridSize) {
float x = Mathf.Round(worldPos.x / gridSize) * gridSize;
float y = Mathf.Round(worldPos.y / gridSize) * gridSize;
//Debug.Log($"{x}, {y}");
return new Vector3(x, y, 0);
}
@ -99,10 +84,7 @@ public class BuildHandler : ScriptableObject {
}
}
if (VfxExplosionParentInstance) {
VfxExplosionParentInstance.transform.position = SnappedPosition;
VfxExplosionParticles.ForEach((x) => x.Play());
}
Sparkle?.PlayAll(SnappedPosition);
GameObject newObj = Instantiate(PrefabToSpawn, SnappedPosition, Quaternion.identity);
SpriteRenderer image = newObj.GetComponent<SpriteRenderer>();
}
@ -121,16 +103,10 @@ public class BuildHandler : ScriptableObject {
TileBase tile = tilemap.GetTile(cellPos);
if (!tile) return false;
return tile;
//Bounds tileBounds = tilemap.GetBoundsLocal(cellPos);
//Collider2D[] hits = Physics2D.OverlapBoxAll(tilemap.GetCellCenterWorld(cellPos), tilemap.cellSize * 0.9f, 0f);
//return (hits.Length == 0);
}
public void DrawGizmos() {
if (!Initialized) return;
Vector2 center = SnappedPosition;
Vector2 size = SpriteSize;
float radius = size.x / 2 * 0.8f;

View File

@ -28,6 +28,9 @@ public class Player : MonoBehaviour {
[SerializeField] private float DriftSpeed = 60;
[SerializeField] private float DriftFactorial = 0.85f;
[Header("VFX Dependencies")]
public VfxHandlerBase DashEffect;
private Vector2 MoveDirection = Vector2.zero;
private Directions FaceDir = Directions.Down;
@ -42,7 +45,7 @@ public class Player : MonoBehaviour {
private enum Directions { Left, Right, Up, Down }
void Awake() {
Build.Initialize();
//Build.Initialize();
SetClass(1);
}
@ -79,7 +82,9 @@ public class Player : MonoBehaviour {
isDashing = true;
RigidBody.linearVelocity = direction.normalized * MoveSpeed * DashMultiplier;
float angle = Mathf.Atan2(direction.y, direction.x) * Mathf.Rad2Deg + 180;
if (direction.normalized != Vector2.zero)
DashEffect?.PlayAll(this.transform.position, Quaternion.Euler(0f, 0f, angle));
DriftDirection = direction.normalized;
Drift = DriftSpeed;
isDashing = false;

View File

@ -368,7 +368,7 @@ MonoBehaviour:
CustomLookAtTarget: 0
Lens:
FieldOfView: 60
OrthographicSize: 8
OrthographicSize: 12
NearClipPlane: 0.3
FarClipPlane: 1000
Dutch: 0
@ -482,7 +482,7 @@ Camera:
far clip plane: 1000
field of view: 60
orthographic: 1
orthographic size: 8
orthographic size: 12
m_Depth: -1
m_CullingMask:
serializedVersion: 2
@ -71157,6 +71157,7 @@ MonoBehaviour:
DashMultiplier: 60
DriftSpeed: 60
DriftFactorial: 0.85
DashEffect: {fileID: 11400000, guid: 2b4a9d2bdf4f1e34287cf15a4825a45d, type: 2}
classes: []
maxHealth: 0
maxMana: 0
@ -71451,411 +71452,6 @@ Transform:
m_Children: []
m_Father: {fileID: 0}
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1001 &2144819604
PrefabInstance:
m_ObjectHideFlags: 0
serializedVersion: 2
m_Modification:
serializedVersion: 3
m_TransformParent: {fileID: 0}
m_Modifications:
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: looping
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: lengthInSec
value: 0.7
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: SubModule.enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.size3D
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: LightsModule.enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.dampen
value: 0.1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.enabled
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_BurstCount
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.x.scalar
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.y.scalar
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.z.scalar
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startSpeed.scalar
value: 20
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.inWorldSpace
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.separateAxis
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.size
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.rateOverTime.scalar
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startLifetime.scalar
value: 0.4
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startSpeed.minScalar
value: 10
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.scalar
value: 30
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.minMaxState
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].time
value: 0.05
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startColor.maxGradient.key0.b
value: 0.882353
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startColor.maxGradient.key0.g
value: 0.4117647
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startColor.maxGradient.key0.r
value: 0.254902
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startColor.maxGradient.key1.b
value: 0.882353
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startColor.maxGradient.key1.g
value: 0.4117647
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.startColor.maxGradient.key1.r
value: 0.254902
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].cycleCount
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].probability
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: ClampVelocityModule.multiplyDragByParticleVelocity
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].repeatInterval
value: 0.01
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.scalar
value: 100
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.size
value: 6
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minScalar
value: 30
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[0].time
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[1].time
value: 0.37640697
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[2].time
value: 0.46585402
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[3].time
value: 0.6559812
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[4].time
value: 0.793658
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[5].time
value: 0.9914551
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[0].value
value: 0.3364631
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[1].value
value: 0.2926457
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[2].value
value: -0.3359872
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[3].value
value: 0.23346096
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[4].value
value: -0.86193466
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[5].value
value: -0.9092381
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[0].inSlope
value: -0.116409644
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[1].inSlope
value: -0.3922383
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[2].inSlope
value: -0.16222633
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[3].inSlope
value: -0.27454022
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[4].inSlope
value: -5.5486827
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[5].inSlope
value: 0.057479065
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[0].inWeight
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[0].outSlope
value: -0.116409644
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[1].inWeight
value: 0.100749284
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[1].outSlope
value: -0.3922383
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[2].inWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[2].outSlope
value: -0.16222633
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[3].inWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[3].outSlope
value: -0.27454022
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[4].inWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[4].outSlope
value: -5.5486827
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[5].inWeight
value: 0.35539302
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[5].outSlope
value: 0.057479065
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[0].outWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[1].outWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[2].outWeight
value: 0.59402686
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[3].outWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[4].outWeight
value: 0.33333334
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_PreInfinity
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_PreInfinity
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_PostInfinity
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_PostInfinity
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[0].tangentMode
value: 34
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: InitialModule.gravityModifier.maxCurve.m_Curve.Array.data[1].tangentMode
value: 0
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_RotationOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_RotationOrder
value: 4
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.size
value: 2
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.data[1].time
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.data[1].time
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.data[0].value
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.maxCurve.m_Curve.Array.data[1].value
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.data[0].value
value: 1
objectReference: {fileID: 0}
- target: {fileID: 2245216254181046384, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: EmissionModule.m_Bursts.Array.data[0].countCurve.minCurve.m_Curve.Array.data[1].value
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3872591710361412293, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalScale.x
value: 1
objectReference: {fileID: 0}
- target: {fileID: 3872591710361412293, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalScale.y
value: 1
objectReference: {fileID: 0}
- target: {fileID: 4566952472781634859, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_Name
value: VfxExplosion
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalPosition.x
value: -4.4446874
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalPosition.y
value: -2.4731033
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalPosition.z
value: -17
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalRotation.w
value: 1
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalRotation.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalRotation.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 6728924784702237652, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
m_RemovedComponents: []
m_RemovedGameObjects: []
m_AddedGameObjects: []
m_AddedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 4d965c8262ff5834a878255a7345baac, type: 3}
--- !u!1660057539 &9223372036854775807
SceneRoots:
m_ObjectHideFlags: 0
@ -71867,4 +71463,3 @@ SceneRoots:
- {fileID: 1814202913}
- {fileID: 789851420}
- {fileID: 2108843208}
- {fileID: 2144819604}

View File

@ -41,7 +41,7 @@ ParticleSystem:
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 144220255874236928}
serializedVersion: 8
lengthInSec: 0.7
lengthInSec: 0.4
simulationSpeed: 1
stopAction: 0
cullingMode: 0
@ -116,8 +116,8 @@ ParticleSystem:
startLifetime:
serializedVersion: 2
minMaxState: 3
scalar: 0.8
minScalar: 0.4
scalar: 0.3
minScalar: 0.05
maxCurve:
serializedVersion: 2
m_Curve:
@ -170,7 +170,7 @@ ParticleSystem:
serializedVersion: 2
minMaxState: 3
scalar: 60
minScalar: 40
minScalar: 30
maxCurve:
serializedVersion: 2
m_Curve:
@ -226,7 +226,7 @@ ParticleSystem:
maxColor: {r: 1, g: 1, b: 1, a: 1}
maxGradient:
serializedVersion: 2
key0: {r: 0.254902, g: 0.4117647, b: 0.882353, a: 1}
key0: {r: 0.1, g: 0.1, b: 0.1, a: 1}
key1: {r: 0.254902, g: 0.4117647, b: 0.882353, a: 1}
key2: {r: 1, g: 1, b: 1, a: 0}
key3: {r: 0, g: 0, b: 0, a: 0}
@ -235,7 +235,7 @@ ParticleSystem:
key6: {r: 0, g: 0, b: 0, a: 0}
key7: {r: 0, g: 0, b: 0, a: 0}
ctime0: 0
ctime1: 51914
ctime1: 28913
ctime2: 65535
ctime3: 0
ctime4: 0
@ -243,7 +243,7 @@ ParticleSystem:
ctime6: 0
ctime7: 0
atime0: 0
atime1: 51400
atime1: 27628
atime2: 65535
atime3: 0
atime4: 0
@ -287,8 +287,8 @@ ParticleSystem:
startSize:
serializedVersion: 2
minMaxState: 3
scalar: 0.5
minScalar: 0.2
scalar: 0.25
minScalar: 0.1
maxCurve:
serializedVersion: 2
m_Curve:

View File

@ -1,4 +1,5 @@
using System.Collections.Generic;
using Unity.VisualScripting;
using UnityEngine;
[CreateAssetMenu(menuName = "Custom/VfxHandler", fileName = "NewVfxHandler")]
@ -8,9 +9,12 @@ public class VfxHandlerBase : ScriptableObject {
private GameObject VfxExplosionParentInstance;
private List<ParticleSystem> VfxExplosionParticles = new List<ParticleSystem>();
public bool Initialized { get; private set; }
private void Awake() {
private void OnEnable() {
GenerateInstance();
}
private void GenerateInstance() {
VfxExplosionParticles.Clear();
if (VfxExplosion) {
VfxExplosionParentInstance = Instantiate(VfxExplosion, Vector3.one, Quaternion.identity);
@ -18,16 +22,14 @@ public class VfxHandlerBase : ScriptableObject {
VfxExplosionParticles.AddRange(foundParticleSystems);
VfxExplosionParticles.ForEach((x) => x.transform.localScale = Vector3.one);
}
Initialized = true;
}
private void PlayAll(Vector3? location = null, Quaternion? rotation = null) {
if (!Initialized) return;
if (VfxExplosionParentInstance) {
public void PlayAll(Vector3? location = null, Quaternion? rotation = null) {
if (!VfxExplosionParentInstance) GenerateInstance();
if (location != null) VfxExplosionParentInstance.transform.position = (Vector3)location;
if (rotation != null) VfxExplosionParentInstance.transform.rotation = (Quaternion)rotation;
VfxExplosionParticles.ForEach((x) => x.Play());
}
}
}

View File

@ -10,6 +10,6 @@ MonoBehaviour:
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 2b91e52b0bfa8904ca14f8379059ff5c, type: 3}
m_Name: VfxHandlerExplosion02
m_Name: VfxHandlerDash01
m_EditorClassIdentifier:
VfxExplosion: {fileID: 0}
VfxExplosion: {fileID: 4566952472781634859, guid: daf6ae43ee06c424ba624a471e90b72c, type: 3}

View File

@ -12,4 +12,4 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: 2b91e52b0bfa8904ca14f8379059ff5c, type: 3}
m_Name: VfxHandlerExplosion01
m_EditorClassIdentifier:
VfxExplosion: {fileID: 0}
VfxExplosion: {fileID: 4566952472781634859, guid: 4d965c8262ff5834a878255a7345baac, type: 3}

View File

@ -9,10 +9,10 @@ onBoardingDoNotAskAgain = true
showPackageIndexes = false
showStatusBar = false
scopes = {
"last_search.66F56946" = ""
"last_search.66F56946" = "ui"
"OpenInspectorPreview.66F56946" = "0"
"currentGroup.66F56946" = null
"picker_window_position_offset.075BCD15" = "127;263;320;550"
"currentGroup.66F56946" = "menu"
"picker_window_position_offset.075BCD15" = "127.3334;263.3333;320;550"
"picker_visibility_flags.075BCD15" = "264"
"picker_item_size.075BCD15" = "96"
"picker_inspector.075BCD15" = "0"
@ -90,4 +90,4 @@ helperWidgetCurrentArea = "all"
disabledIndexers = ""
minIndexVariations = 2
findProviderIndexHelper = true
itemIconSize = 32
itemIconSize = 1