void GroupedCompleted(ItemParticlesAnimation _itemToAnimate) { if (showEventsCallback) { Debug.Log("TotalCompleted " + _itemToAnimate.name); } }
void AppearingCompleted(ItemParticlesAnimation _itemToAnimate) { if (showEventsCallback) { Debug.Log("Completed " + _itemToAnimate.name); } }
void ItemGrouped(ItemParticlesAnimation _itemToAnimate) { if (showEventsCallback) { Debug.Log("Group " + _itemToAnimate.name); } }
void ItemAppearing(ItemParticlesAnimation _itemToAnimate) { if (showEventsCallback) { Debug.Log("Appear " + _itemToAnimate.name); } }
/// <summary> /// Called on appearing sequence complete /// </summary> /// <param name="_itemToAnimate"></param> public void OneItemAppearingCompleted(ItemParticlesAnimation _itemToAnimate) { if (_itemToAnimate.itemAnimationData.compt > 0) { ItemAppearing?.Invoke(_itemToAnimate); } _itemToAnimate.itemAnimationData.compt--; if (_itemToAnimate.itemAnimationData.compt <= 0) { _itemToAnimate.itemAnimationData.compt = _itemToAnimate.itemAnimationData.quantity; OnAppearingCompleted?.Invoke(_itemToAnimate); } }
/// <summary> /// Per item callback once grouping is achieved /// </summary> /// <param name="_particle"></param> public void OneItemGroupingCompleted(ItemParticlesAnimation _particle) { if (_particle.itemAnimationData.compt > 0) { SetUnused(_particle); ItemGrouped?.Invoke(_particle); } _particle.itemAnimationData.compt--; if (_particle.itemAnimationData.compt <= 0) { _particle.itemAnimationData.compt = _particle.itemAnimationData.quantity; OnGroupedCompleted?.Invoke(_particle); } }
public ItemParticlesAnimation GetUnusedOrCreate() { for (int i = particles.Count - 1; i >= 0; i--) { if (particles[i].isUsed == false) { return(particles[i]); } } GameObject element = Instantiate(itemToAnimatePrefab.gameObject); element.transform.SetParent(parentGameObjects, false); ItemParticlesAnimation particle = element.GetComponent <ItemParticlesAnimation>(); particles.Add(particle); return(particle); }
/// <summary> /// Set a particle group ready to start animation /// </summary> /// <param name="_item"></param> public void SetUnused(ItemParticlesAnimation _item) { _item.transform.localScale = Vector3.one; _item.gameObject.SetActive(false); _item.isUsed = false; }