public void RegisterTransform(IHaveTransform owner, Transform property) { if (!transformRegistry.ContainsKey(owner)) { transformRegistry.Add(owner, property); } }
public bool TryGetOwner(Transform transform, out IHaveTransform owner) { if (transformRegistry.ContainsValue(transform)) { var temp = transformRegistry.FirstOrDefault(pair => pair.Value == transform); owner = temp.Key; return(owner != null); } owner = null; return(false); }
public void DismissTransform(IHaveTransform owner) { if (_transformRegistry.ContainsKey(owner)) { var transform = _transformRegistry[owner]; if (transform) { Destroy(transform.gameObject); } _transformRegistry.Remove(owner); } }
public bool TryGetTransformOwner(Transform transform, out IHaveTransform owner) { foreach (var value in _transformRegistry) { if (value.Value != transform) { continue; } owner = value.Key; return(true); } owner = null; return(false); }
public void DismissTransform(IHaveTransform owner) { if (!transformRegistry.ContainsKey(owner)) { return; } var transform = transformRegistry[owner]; if (transform) { Object.Destroy(transform.gameObject); } transformRegistry.Remove(owner); }
public void RegisterTransform(IHaveTransform owner, Transform property) { _transformRegistry.Add(owner, property); }