paint fix, tower fix

This commit is contained in:
dddushesss 2022-01-11 04:57:05 +03:00
parent 7c5979e6a9
commit 2528c3e4dd
19 changed files with 88 additions and 429 deletions

View File

@ -4822,7 +4822,6 @@ GameObject:
- component: {fileID: 4578021055421579414}
- component: {fileID: 4578021055435659058}
- component: {fileID: 4578021055437630178}
- component: {fileID: 4578021055424340148}
m_Layer: 0
m_Name: DeathBlue
m_TagString: Untagged
@ -4860,7 +4859,7 @@ ParticleSystem:
lengthInSec: 3
simulationSpeed: 1
stopAction: 2
cullingMode: 3
cullingMode: 1
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
looping: 0
@ -9601,102 +9600,6 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0}
m_MaskInteraction: 0
--- !u!82 &4578021055424340148
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 4578021055421768374}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: b1acecdf352627048b995eca86c0f8ec, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
--- !u!1 &4578021055421788354
GameObject:
m_ObjectHideFlags: 0

View File

@ -24142,7 +24142,6 @@ GameObject:
- component: {fileID: 8483527721606191231}
- component: {fileID: 8483527721625702363}
- component: {fileID: 8483527721626104331}
- component: {fileID: 8483527721614194781}
m_Layer: 0
m_Name: DeathGreen
m_TagString: Untagged
@ -24180,7 +24179,7 @@ ParticleSystem:
lengthInSec: 3
simulationSpeed: 1
stopAction: 2
cullingMode: 3
cullingMode: 1
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
looping: 0
@ -28921,99 +28920,3 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0}
m_MaskInteraction: 0
--- !u!82 &8483527721614194781
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 8483527721606052447}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: b1acecdf352627048b995eca86c0f8ec, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0

View File

@ -24142,7 +24142,6 @@ GameObject:
- component: {fileID: 730781534365034970}
- component: {fileID: 730781534379310718}
- component: {fileID: 730781534378378158}
- component: {fileID: 730781534365420024}
m_Layer: 0
m_Name: DeathRed
m_TagString: Untagged
@ -24180,7 +24179,7 @@ ParticleSystem:
lengthInSec: 3
simulationSpeed: 1
stopAction: 2
cullingMode: 3
cullingMode: 1
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
looping: 0
@ -28921,99 +28920,3 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0}
m_MaskInteraction: 0
--- !u!82 &730781534365420024
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 730781534364879866}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: b1acecdf352627048b995eca86c0f8ec, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0

View File

@ -24142,7 +24142,6 @@ GameObject:
- component: {fileID: 7140011676602217546}
- component: {fileID: 7140011676621711426}
- component: {fileID: 7140011676621667256}
- component: {fileID: 7140011676610264564}
m_Layer: 0
m_Name: DeathYellow
m_TagString: Untagged
@ -24180,7 +24179,7 @@ ParticleSystem:
lengthInSec: 3
simulationSpeed: 1
stopAction: 2
cullingMode: 3
cullingMode: 1
ringBufferMode: 0
ringBufferLoopRange: {x: 0, y: 1}
looping: 0
@ -28921,99 +28920,3 @@ ParticleSystemRenderer:
m_Mesh2: {fileID: 0}
m_Mesh3: {fileID: 0}
m_MaskInteraction: 0
--- !u!82 &7140011676610264564
AudioSource:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 7140011676602114744}
m_Enabled: 1
serializedVersion: 4
OutputAudioMixerGroup: {fileID: 0}
m_audioClip: {fileID: 8300000, guid: b1acecdf352627048b995eca86c0f8ec, type: 3}
m_PlayOnAwake: 1
m_Volume: 1
m_Pitch: 1
Loop: 0
Mute: 0
Spatialize: 0
SpatializePostEffects: 0
Priority: 128
DopplerLevel: 1
MinDistance: 1
MaxDistance: 500
Pan2D: 0
rolloffMode: 0
BypassEffects: 0
BypassListenerEffects: 0
BypassReverbZones: 0
rolloffCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
- serializedVersion: 3
time: 1
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 4
panLevelCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
spreadCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 0
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0
reverbZoneMixCustomCurve:
serializedVersion: 2
m_Curve:
- serializedVersion: 3
time: 0
value: 1
inSlope: 0
outSlope: 0
tangentMode: 0
weightedMode: 0
inWeight: 0.33333334
outWeight: 0.33333334
m_PreInfinity: 2
m_PostInfinity: 2
m_RotationOrder: 0

View File

@ -26,25 +26,29 @@ MonoBehaviour:
colors:
- _unitColor: 2
_texture: {fileID: 2800000, guid: 983242f4b4db7a841af48234cf0021b8, type: 3}
_vfxPrefab: {fileID: 0}
_buildinMaterial: {fileID: 0}
_vfxCellCapturePrefab: {fileID: 0}
_vfxDeathPrefab: {fileID: 0}
- _unitColor: 0
_texture: {fileID: 2800000, guid: 0298dfcb0756f534a9a125d510461c7a, type: 3}
_vfxPrefab: {fileID: 8021195855904498788, guid: 2f6d0540c8fd7bb46b356ff86962379c,
_vfxCellCapturePrefab: {fileID: 8021195855904498788, guid: 2f6d0540c8fd7bb46b356ff86962379c,
type: 3}
_vfxDeathPrefab: {fileID: 8483527721606052447, guid: fd7fc481b936cf84a90d2d01d83e9b06,
type: 3}
_buildinMaterial: {fileID: 2100000, guid: 948554a1d458a2f42afa262d79d6b7b8, type: 2}
- _unitColor: 1
_texture: {fileID: 2800000, guid: 3b75368df991b164583e8cede390e24e, type: 3}
_vfxPrefab: {fileID: 442387583353148024, guid: 53959bc898e9a644daad0282881d596a,
_vfxCellCapturePrefab: {fileID: 442387583353148024, guid: 53959bc898e9a644daad0282881d596a,
type: 3}
_vfxDeathPrefab: {fileID: 730781534364879866, guid: 15620662117187f419d41032a4267445,
type: 3}
_buildinMaterial: {fileID: 2100000, guid: 9eb3fa679bb990142a02982fb51700c9, type: 2}
- _unitColor: 3
_texture: {fileID: 2800000, guid: 1a76a79d5a83143479c76f4f37c4b896, type: 3}
_vfxPrefab: {fileID: 5732852186060375560, guid: 54d847a18c62f57479c53469d4398ceb,
_vfxCellCapturePrefab: {fileID: 5732852186060375560, guid: 54d847a18c62f57479c53469d4398ceb,
type: 3}
_vfxDeathPrefab: {fileID: 7140011676602114744, guid: 6d9f179a27798c248b3c35df9139eb85,
type: 3}
_buildinMaterial: {fileID: 2100000, guid: 8720b7cac4364f14f961a3b6968c9beb, type: 2}
- _unitColor: 4
_texture: {fileID: 2800000, guid: 779719648deedb4478ddebb3b81751ef, type: 3}
_vfxPrefab: {fileID: 1651852338557341938, guid: fa6c1fc3da7c8d24c85a88b00cf598d4,
_vfxCellCapturePrefab: {fileID: 1651852338557341938, guid: fa6c1fc3da7c8d24c85a88b00cf598d4,
type: 3}
_vfxDeathPrefab: {fileID: 4578021055421768374, guid: b2b879dd7ca552a408d4349691d2c8df,
type: 3}
_buildinMaterial: {fileID: 2100000, guid: 38aadeb2461f2b249bebec6bc7e539d9, type: 2}

View File

@ -21,7 +21,7 @@ MonoBehaviour:
type: 3}
color: 3
manaRegen: 10
maxMana: 100
maxMana: 10000000
maxHP: 100
inventoryCapacity: 4
- isPlayer: 0

View File

@ -81,12 +81,12 @@ namespace Controller
hexGrid.OnHexPainted += paintedController.SetHexColors;
hexGrid.OnHexPainted += itemFabric.UpdateCellToOpenList;
hexGrid.OnHexPainted += paintedController.CheckDeath;
hexGrid.OnHexPainted += paintedController.CheckDeathOrDestroy;
}
private List<Type> SetUpItems()
{
return new List<Type>() { typeof(Tower), typeof(AttackBonus), typeof(DefenceBonus) };
return new List<Type>() { typeof(Building), typeof(AttackBonus), typeof(DefenceBonus) };
}
}
}

View File

@ -8,13 +8,14 @@ namespace HexFiled
{
[SerializeField] private UnitColor _unitColor;
[SerializeField] private Texture _texture;
[SerializeField] private GameObject _vfxPrefab;
[SerializeField] private Material _buildinMaterial;
[SerializeField] private GameObject _vfxCellCapturePrefab;
[SerializeField] private GameObject _vfxDeathPrefab;
public UnitColor UnitColor => _unitColor;
public Texture Texture => _texture;
public Material BuildingMaterial => _buildinMaterial;
public GameObject VFXPrefab => _vfxPrefab;
public GameObject VFXDeathPrefab => _vfxDeathPrefab;
public GameObject VFXCellCapturePrefab => _vfxCellCapturePrefab;

View File

@ -4,6 +4,7 @@ using System.Linq;
using DefaultNamespace;
using Items;
using UnityEngine;
using UnityEngine.UI;
using Random = UnityEngine.Random;
namespace HexFiled
@ -27,6 +28,19 @@ namespace HexFiled
public UnitColor Color => _color;
public Item Item => _item;
private TowerView _towerView;
public TowerView Building
{
get => _towerView;
set
{
if (_towerView != null)
{
_towerView = value;
}
}
}
private void Awake()
{
@ -76,7 +90,7 @@ namespace HexFiled
}
_renderer.material.mainTexture = HexGrid.Colors[color].Texture;
var previousColor = _color;
_color = color;
if (!HexManager.CellByColor.ContainsKey(_color))
@ -85,12 +99,14 @@ namespace HexFiled
}
else
{
if(previousColor != UnitColor.GREY && HexManager.CellByColor[previousColor].Remove(this))
{
Debug.Log("Repainted");
}
HexManager.CellByColor[_color].Add(this);
}
var vfx = VFXController.Instance.PlayEffect(HexGrid.Colors[color].VFXPrefab, transform.position + new Vector3(0,0.1f,0));
var vfx = VFXController.Instance.PlayEffect(HexGrid.Colors[color].VFXCellCapturePrefab, transform.position + new Vector3(0,0.1f,0));
MusicController.Instance.AddAudioSource(vfx);
MusicController.Instance.PlayRandomClip(MusicController.Instance.MusicData.SfxMusic.Captures, vfx);

View File

@ -26,6 +26,7 @@ namespace HexFiled
public int HexHardCaptureCost => _fieldData.hexHardCaptureManaCost;
public float HardCaptureTime => _fieldData.hexHardCaptureTime;
public static Dictionary<UnitColor, CellColor> Colors => _colors;

View File

@ -56,7 +56,7 @@ namespace HexFiled
field.ForEach(x => actions.Add(x.PaintHex));
TimerHelper.Instance.StartTimer(actions, 0.05f, color);
TimerHelper.Instance.StartTimer(actions, 0.01f, color);
}

View File

@ -1,6 +1,8 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Units;
using UnityEngine;
using Random = UnityEngine.Random;
namespace HexFiled
@ -15,12 +17,19 @@ namespace HexFiled
HexManager.UnitCurrentCell = new Dictionary<UnitColor, (HexCell cell, Unit unit)>();
}
public void CheckDeath(HexCell cell)
public void CheckDeathOrDestroy(HexCell cell)
{
foreach (var cells in HexManager.UnitCurrentCell.Where(cells => HexManager.CellByColor[cells.Key].Count < 2 || (cells.Value.cell == cell && cells.Value.unit.Color != cell.Color)))
foreach (var cells in HexManager.UnitCurrentCell
.Where(cells => HexManager.CellByColor[cells.Key].Count < 2 || (cells.Value.cell == cell && cells.Value.unit.Color != cell.Color)))
{
cells.Value.unit.Death();
}
if (cell.Building != null && cell.Building.Color != cell.Color)
{
}
}
public void SetHexColors(HexCell cell)
{

View File

@ -7,10 +7,11 @@ using Object = UnityEngine.Object;
namespace Items
{
public class Tower : Item
public class Building : Item
{
public Tower(ItemInfo data) : base(data)
public Building(ItemInfo data) : base(data)
{
}
@ -30,6 +31,7 @@ namespace Items
Unit.UseItem(this);
var obj = Object.Instantiate(Data.SpawnablePrefab, cell.transform.position + Data.SpawnablePrefab.transform.position, Quaternion.identity);
obj.GetComponent<TowerView>().SetUp(Unit.Color);
cell.Building = obj.GetComponent<TowerView>();
OnItemUsed?.Invoke(this);
}
}

View File

@ -8,14 +8,17 @@ using Object = UnityEngine.Object;
namespace Items
{
public abstract class Item
public abstract class Item : IDisposable
{
private GameObject _instance;
protected ItemInfo Data;
protected Unit Unit;
protected Action<Item> OnItemUsed;
public bool IsInstantUse => Data.IsInstanceUse;
public Sprite Icon => Data.Icon;
public UnitColor Color => Unit.Color;
protected Item(ItemInfo data)
{
Data = data;
@ -28,13 +31,19 @@ namespace Items
public GameObject Spawn(HexCell cell)
{
var item = Object.Instantiate(Data.Prefab, cell.transform.position + new Vector3(0, 1, 0),
_instance = Object.Instantiate(Data.Prefab, cell.transform.position + new Vector3(0, 1, 0),
Quaternion.identity);
return item;
return _instance;
}
public abstract void Invoke(Action<Item> item);
public abstract void InstanceInvoke();
public abstract void PlaceItem(HexCell cell);
public void Dispose()
{
Object.Destroy(_instance);
}
}
}

View File

@ -50,13 +50,13 @@ namespace Items
time = Time.time;
var cell = _openList[Random.Range(0, _openList.Count - 1)];
while (closedList.Contains(cell) || cell.Item != null)
if (closedList.Contains(cell) || cell.Item != null)
{
return;
}
var type = GetWeightedType();
while (type == null)
if (type == null)
{
return;
}

View File

@ -23,15 +23,14 @@ public class TowerView : MonoBehaviour
private UnitColor _color;
private GameObject _target;
[SerializeField] private Weapon weapon;
[SerializeField] private SkinnedMeshRenderer _meshRenderer;
[SerializeField] private List<Crystal> crystals;
public UnitColor Color => _color;
public void SetUp(UnitColor unitColor)
{
_color = unitColor;
_meshRenderer.material = HexGrid.Colors[unitColor].BuildingMaterial;
crystals.First(x => x.UnitColor == unitColor).GameObject.SetActive(true);
var capsule = gameObject.AddComponent<CapsuleCollider>();
capsule.radius = weapon.disnatce * HexGrid.HexDistance;

View File

@ -295,9 +295,12 @@ namespace Units
_isAlive = false;
HexManager.UnitCurrentCell.Remove(Color);
_animator.SetTrigger("Death");
TimerHelper.Instance.StartTimer(() => { Object.Destroy(_instance); }, _animLength.Death);
var vfx = VFXController.Instance.PlayEffect(HexGrid.Colors[Color].VFXDeathPrefab,
_instance.transform.position);
vfx.GetComponent<VFXView>().OnPlayEnd += () => Object.Destroy(_instance);
OnDeath?.Invoke(this);
MusicController.Instance.PlayAudioClip(MusicController.Instance.MusicData.SfxMusic.Death, _instance);
MusicController.Instance.AddAudioSource(vfx);
MusicController.Instance.PlayAudioClip(MusicController.Instance.MusicData.SfxMusic.Death, vfx);
MusicController.Instance.RemoveAudioSource(_instance);
HexManager.PaintHexList(HexManager.CellByColor[Color], UnitColor.GREY);
}

View File

@ -6,17 +6,20 @@ namespace DefaultNamespace
public class VFXView : MonoBehaviour
{
private ParticleSystem _system;
public Action OnPlayEnd;
private void Start()
{
_system = GetComponent<ParticleSystem>();
}
private void Update()
{
if (_system != null && _system.isStopped)
if (_system != null && !_system.IsAlive())
{
MusicController.Instance.RemoveAudioSource(gameObject);
OnPlayEnd?.Invoke();
Destroy(gameObject);
}
}