using System; using System.Collections.Generic; using UnityEngine; namespace Continentis.MainGame { public interface IGameElement { public static readonly Dictionary Instances = new Dictionary(); public Guid elementID { get; set; } public void Initialize() { elementID = Guid.NewGuid(); if (!Instances.ContainsKey(this.elementID)) { Instances.Add(this.elementID, this); } else { Debug.LogWarning($"GameElement with ID {this.elementID} is already registered."); } } public void Unregister() { if (Instances.ContainsKey(this.elementID)) { Instances.Remove(this.elementID); } } } }