private void Awake() { _poolObject = GetComponent <AntPoolObject>(); var availComponents = AntEffectEngine.AvailableComponents; _components = new IComponent[availComponents.Length]; _componentsCount = _components.Length; for (int i = 0, n = availComponents.Length; i < n; i++) { ConstructorInfo constructor = availComponents[i].GetConstructor(Type.EmptyTypes); var comp = (IComponent)constructor.Invoke(null); if (comp != null) { comp.Initialize(this); _components[i] = comp; } } _sortingGroup = GetComponent <SortingGroup>(); _hasSortingGroup = (_sortingGroup != null); if (!_hasSortingGroup) { _spriteRenderer = GetComponent <SpriteRenderer>(); _hasSpriteRenderer = (_spriteRenderer != null); } }
private void Awake() { _isActive = false; _transform = GetComponent <Transform>(); _poolObject = GetComponent <AntPoolObject>(); if (_poolObject != null) { _poolObject.EventExtractedFromPool += ExtractedFromPoolHandler; _poolObject.EventReturnedToPool += ReturnToPoolHandler; } else { ExtractedFromPoolHandler(); } }