Class EntityViewRegistry
- Namespace
- TDMaker.Unity.View
- Assembly
- TDMaker.Unity.dll
Creates, pools and updates EntityViews from simulation events. Prefabs come from authoring assets or the TDMaker.Unity.View.EntityViewRegistry.overrides list (by view key); otherwise generated primitive sprites are used. Also routes per-template presentation hooks (VFX prefabs through VfxPool, audio cues through AudioCuePlayer) and draws built-in feedback: impact flashes, splash rings and instant-hit beams.
[DefaultExecutionOrder(100)]
[AddComponentMenu("2D Tower Defense Maker/Entity View Registry")]
public sealed class EntityViewRegistry : MonoBehaviour
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourEntityViewRegistry
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Constructors
EntityViewRegistry()
public EntityViewRegistry()
Fields
RemainsArtKey
Art set key whose sprite replaces the generated body marker (optional).
public const string RemainsArtKey = "remains"
Field Value
Properties
ActiveCount
Number of live (not dying) views.
public int ActiveCount { get; }
Property Value
ArtSet
The sprite set in use (may be null).
public ArtSet ArtSet { get; set; }
Property Value
BeamLineCount
Number of beam lines currently drawn (including fading ones).
public int BeamLineCount { get; }
Property Value
RemainsMarkerCount
Number of body markers currently drawn (including fading ones).
public int RemainsMarkerCount { get; }
Property Value
Runner
The runner whose events drive this registry.
public SimulationRunner Runner { get; }
Property Value
ShowsRemains
Whether body markers are drawn in the running level (a template raises bodies and markers are on).
public bool ShowsRemains { get; }
Property Value
SpriteMaterial
Material used for generated sprites.
public Material SpriteMaterial { get; }
Property Value
- Material
TrapMarkerCount
Number of trap markers currently drawn (including fading ones).
public int TrapMarkerCount { get; }
Property Value
Methods
Configure(SimulationRunner, Material)
Assigns the runner; call before enabling.
public void Configure(SimulationRunner source, Material material)
Parameters
sourceSimulationRunnermaterialMaterial
ConfigureHooks(VfxPool, AudioCuePlayer)
Assigns optional hook routers.
public void ConfigureHooks(VfxPool pool, AudioCuePlayer audio)
Parameters
poolVfxPoolaudioAudioCuePlayer
Connect()
Initializes pools and subscribes to the runner. Called from OnEnable; tools may call it in edit mode.
public void Connect()
Render(float)
Interpolates views and ages effects. Called from LateUpdate; tools may call it in edit mode.
public void Render(float deltaTime)
Parameters
deltaTimefloat
ResolveIcon(EntityAssetBase, out Sprite, out Color)
Resolves the sprite and colour a template is drawn with (for HUD icons and placement ghosts): the prefab's first SpriteRenderer when present, otherwise the generated primitive.
public static void ResolveIcon(EntityAssetBase asset, out Sprite sprite, out Color color)
Parameters
assetEntityAssetBasespriteSpritecolorColor
ResolveIconWithArt(EntityAssetBase, out Sprite, out Color)
Like ResolveIcon(EntityAssetBase, out Sprite, out Color), but prefers the art set's icon for templates without their own prefab.
public void ResolveIconWithArt(EntityAssetBase asset, out Sprite sprite, out Color color)
Parameters
assetEntityAssetBasespriteSpritecolorColor
TryGetArt(string, out Entry)
Finds the art set entry for a view key, if an art set is assigned and covers it.
public bool TryGetArt(string viewKey, out ArtSet.Entry entry)
Parameters
Returns
TryGetView(int, out EntityView)
Finds the view bound to an entity.
public bool TryGetView(int entityId, out EntityView view)
Parameters
entityIdintviewEntityView