1 [
ComponentEditorProps(
category:
"GameScripted/Editor", description:
"Camera for in-game editor. Works only with SCR_EditorBaseEntity!", icon:
"WBData/ComponentEditorProps/componentEditor.png")]
5 private ref array<ref SCR_CameraParticleEditor> m_Effects;
7 int GetEffects(notnull array<SCR_CameraParticleEditor> outEffects)
12 outEffects.Insert(effect);
14 return outEffects.Count();
18 return m_Effects.Count();
22 return m_Effects[
index];
30 private int m_iCurrentEffect;
33 int GetEffects(notnull array<SCR_CameraParticleEditor> outEffects)
36 if (!prefabData)
return 0;
38 return prefabData.GetEffects(outEffects);
42 SetCurrentEffect(m_iCurrentEffect);
44 void SetCurrentEffect(
int index)
47 if (!prefabData || index < 0 || index >= prefabData.GetEffectsCount())
return;
50 if (effect) effect.Destroy();
52 m_iCurrentEffect =
index;
54 effect = prefabData.GetEffect(m_iCurrentEffect);
55 if (effect) effect.Create(m_CameraManager.GetCamera());
57 int GetCurrentEffect()
59 return m_iCurrentEffect;
61 override void EOnEditorPostActivate()
64 if (!m_CameraManager)
return;
66 if (m_CameraManager.GetCamera())
67 RefreshCurrentEffect(
null);
69 m_CameraManager.GetOnCameraCreate().Insert(RefreshCurrentEffect);
71 override void EOnEditorDeactivate()
73 if (m_CameraManager) m_CameraManager.GetOnCameraCreate().Remove(RefreshCurrentEffect);
79 if (effect) effect.Destroy();
91 private ResourceName m_Effect;
93 private ParticleEffectEntity m_Emitter;
95 string GetDisplayName()
100 void Create(IEntity target)
102 if (m_Effect.IsEmpty())
return;
104 ParticleEffectEntitySpawnParams spawnParams();
105 spawnParams.Parent = target;
106 m_Emitter = ParticleEffectEntity.SpawnParticleEffect(m_Effect, spawnParams);