Ejemplo n.º 1
0
 void GroupedCompleted(ItemParticlesAnimation _itemToAnimate)
 {
     if (showEventsCallback)
     {
         Debug.Log("TotalCompleted " + _itemToAnimate.name);
     }
 }
Ejemplo n.º 2
0
 void AppearingCompleted(ItemParticlesAnimation _itemToAnimate)
 {
     if (showEventsCallback)
     {
         Debug.Log("Completed " + _itemToAnimate.name);
     }
 }
Ejemplo n.º 3
0
 void ItemGrouped(ItemParticlesAnimation _itemToAnimate)
 {
     if (showEventsCallback)
     {
         Debug.Log("Group " + _itemToAnimate.name);
     }
 }
Ejemplo n.º 4
0
 void ItemAppearing(ItemParticlesAnimation _itemToAnimate)
 {
     if (showEventsCallback)
     {
         Debug.Log("Appear " + _itemToAnimate.name);
     }
 }
Ejemplo n.º 5
0
        /// <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);
            }
        }
Ejemplo n.º 6
0
        /// <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);
            }
        }
Ejemplo n.º 7
0
        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);
        }
Ejemplo n.º 8
0
 /// <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;
 }