Example #1
0
 public virtual IEnumerator OnStart(BuffInstance instance)
 {
     OnStartBurst(instance);
     OnStartLoop(instance);
     instance.period = instance.target.StartCoroutine(OnPeriod(instance));
     yield return(null);
 }
Example #2
0
 public void RemoveBuff(BuffInstance instance)
 {
     if (!instance.removed)
     {
         buffs.Remove(instance);
         instance.removed = true;
     }
 }
Example #3
0
 protected void OnStartLoop(BuffInstance instance)
 {
     if (startLoopParticle != null)
     {
         ParticleSystem ps = GameObject.Instantiate(startLoopParticle,
                                                    instance.target.transform).
                             GetComponent <ParticleSystem>();
         ps.transform.localPosition = startLoopOffset;
         ps.Play(true);
         instance.startLoopParticle = ps.gameObject;
     }
 }
Example #4
0
        public virtual IEnumerator OnPeriod(BuffInstance instance)
        {
            while (!instance.canExpire || instance.duration > 0)
            {
                OnPeriodBurst(instance);
                instance.target.StartCoroutine(DoOnPeriod(instance));
                yield return(new WaitForSeconds(periodInterval));

                instance.duration -= periodInterval;
            }
            instance.Stop();
        }
Example #5
0
 protected void OnPeriodBurst(BuffInstance instance)
 {
     if (periodBurstParticle != null)
     {
         if (periodBurstAttach)
         {
             ParticleSystem ps = GameObject.Instantiate(periodBurstParticle,
                                                        instance.target.transform).
                                 GetComponent <ParticleSystem>();
             ps.transform.localPosition = periodBurstOffset;
             ps.Play(true);
             GameObject.Destroy(ps.gameObject, ps.main.duration);
         }
         else
         {
             ParticleSystem ps = GameObject.Instantiate(periodBurstParticle,
                                                        instance.target.transform.position + instance.target.transform.rotation * periodBurstOffset,
                                                        instance.target.transform.rotation).
                                 GetComponent <ParticleSystem>();
             ps.Play(true);
             GameObject.Destroy(ps.gameObject, ps.main.duration);
         }
     }
 }
Example #6
0
 public void AddBuff(BuffInstance instance)
 {
     buffs.Add(instance);
     StartCoroutine(instance.buff.OnStart(instance));
 }
Example #7
0
 public virtual IEnumerator OnEnd(BuffInstance instance)
 {
     OnEndBurst(instance);
     yield return(null);
 }
Example #8
0
 protected virtual IEnumerator DoOnPeriod(BuffInstance instance)
 {
     yield return(null);
 }
Example #9
0
 protected override IEnumerator DoOnPeriod(BuffInstance instance)
 {
     instance.target.Heal(healthPerPeriod);
     yield return(null);
 }