public void PlayVfx(VfxList inLabel, Vector2 inPosition) { var map = GetVfxMap(inLabel); if (map == null) { throw new Exception($"Vfx {inLabel} not found!"); } IVfx gameVfx = null; switch (map.type) { case VfxType.Animation: gameVfx = GetAnimationVfx(map); break; case VfxType.ParticleSystem: gameVfx = GetParticleVfx(map); break; } if (gameVfx == null) { throw new Exception($"Vfx Is null !"); } VfxList.Add(gameVfx); //- add vfx to level view SystemFacade.Level.Level.AddVfx(gameVfx, new Vector2(inPosition.x, inPosition.y)); //- play sound effect if (map.sfx != SoundList.None) { SystemFacade.Sounds.PlaySfx(map.sfx); } gameVfx?.Play(); }
public void AddVfx(IVfx inVfx, Vector2 inPos) { inVfx.GetTransform().SetParent(_holder); inVfx.SetPosition(inPos); inVfx.SetScale(SystemFacade.Renderer.CurrentResetVector); }
private void OnVfxComplete(IVfx inVfx) { //- vfx complete -> dispawn it VfxList.Remove(inVfx); inVfx.Remove(); }