Exemplo n.º 1
0
        private IEnumerator DoTimedEffect(Creature target, TimedEffectContainer container, float value)
        {
            TimedEffect timedEffect = container.timedEffect;

            float startTime = Time.time + timedEffect.timeToStart;
            float endTime   = Time.time + timedEffect.timeToStart + timedEffect.duration;

            Debug.Log("start time: " + startTime + ", name: " + timedEffect.name);
            Debug.Log("czas: " + Time.time);

            while (Time.time < startTime)
            {
                yield return(null);
            }

            timedEffect.ApplyEffectAction(target, value);

            while (Time.time <= endTime)
            {
                endTime = startTime + container.timeToEnd;
                yield return(null);
            }
            Debug.Log("end time: " + endTime + "| effect final duration: " + container.timeToEnd + ", name: " + timedEffect.name);
            timedEffect.EndEffect(target);
        }
Exemplo n.º 2
0
        public override void EndEffectAction(Creature target)
        {
            Debug.Log("end effect: " + this.name);
            TimedEffectContainer container = GetEffectContainer(target) as TimedEffectContainer;

            effectAction.EndEffect(target, container.ChangeinTargetValue);
        }
Exemplo n.º 3
0
        public override bool CheckForReduplication(Creature target)
        {
            TimedEffectContainer container = GetEffectContainer(target) as TimedEffectContainer;

            if (container != null)
            {
                container.ResolveReduplication(target, this);
                return(true);
            }
            return(false);
        }
Exemplo n.º 4
0
        private IEnumerator EffectRepeater(Creature target, TimedEffectContainer container, float value)
        {
            TimedEffect timedEffect = container.timedEffect;
            float       startTime   = Time.time + timedEffect.timeToStart;
            float       endTime     = Time.time + timedEffect.timeToStart + timedEffect.duration;

            while (Time.time < startTime)
            {
                yield return(null);
            }

            while (Time.time <= endTime)
            {
                endTime = startTime + container.timeToEnd;
                StartCoroutine(DoTimedEffect(target, container, value));
                yield return(new WaitForSeconds(timedEffect.repeatTime));
            }
        }
Exemplo n.º 5
0
 private void RemoveEffectAction(Creature target)
 {
     for (int i = 0; i < target.activeBasicEffects.Count; i++)
     {
         BasicEffectContainer container = target.activeBasicEffects [i];
         if (container.basicEffect.effectAction == actionToRemove)
         {
             container.basicEffect.EndEffect(target);
         }
     }
     for (int j = 0; j < target.activeTimedEffects.Count; j++)
     {
         TimedEffectContainer container = target.activeTimedEffects [j];
         if (container.timedEffect.effectAction == actionToRemove)
         {
             container.timedEffect.EndEffect(target);
         }
     }
 }
Exemplo n.º 6
0
 public void StartDoTimedEffect(Creature target, TimedEffectContainer container, float value)
 {
     StartCoroutine(DoTimedEffect(target, container, value));
 }
Exemplo n.º 7
0
 public void StartEffectRepeater(Creature target, TimedEffectContainer container, float value)
 {
     StartCoroutine(EffectRepeater(target, container, value));
 }
Exemplo n.º 8
0
        public override void LogChangeInTargetValue(Creature target, float value)
        {
            TimedEffectContainer container = GetEffectContainer(target) as TimedEffectContainer;

            container.ChangeinTargetValue = value;
        }