示例#1
0
        public void Stun(float stunTimeMS, float stunSpeedMod, float ballImpulse)
        {
            if (m_properties.Invincible)
            {
                return;
            }

            if (m_properties.Stunned)
            {
                return;
            }

            PlayerStunEffect stunEffect = new PlayerStunEffect();

            stunEffect.SetDuration(stunTimeMS);
            stunEffect.Parameters = new StunParamters()
            {
                BallImpulse = ballImpulse
            };

            if (m_ball != null)
            {
                SlowEffect slowEffect = new SlowEffect();
                slowEffect.SetDuration(80);
                m_ball.AddEffect(slowEffect);
            }

            AddEffect(stunEffect);
        }
示例#2
0
    /********************
    *      Slow        *
    ********************/


    public void AddSlow(float percent, float duration)
    {
        SlowEffect slow = new SlowEffect(percent, duration);

        slow.coroutine = StartCoroutine(StartSlowRoutine(slow, duration));
        slowsEffects.Add(slow);
    }
示例#3
0
    void ZombieDeath()
    {
        if (hasDiedBefore)
        {
            animation.Stop();
            animation.Play("disappear");
            return;
        }
        SlowEffect efx = GetComponent <SlowEffect>();

        if (efx != null)
        {
            Destroy(efx);
        }
        PoisonEffect pfx = GetComponent <PoisonEffect>();

        if (pfx != null)
        {
            Destroy(pfx);
        }

        hasDiedBefore = true;
        if (GameSession.Instance.isDefender)
        {
            showGoldGain(Constants.AlienDeathGold[this.GetType().Name]);
        }
        else
        {
            float total = routeManager.distToEnd[0];
            showGoldGain(Mathf.FloorToInt(((total - distToEnd) / total) * (float)Cost));
        }
        StartCoroutine(Reanimate());
    }
示例#4
0
 void ApplySlowEffect(Collider mob)
 {
     se                = mob.gameObject.AddComponent <SlowEffect> () as SlowEffect;
     se.duration       = slowDuration;
     se.ec             = mob.gameObject.GetComponent <EntityController> ();
     se.slowPercentage = slowPercentage;
     se.Apply();
 }
示例#5
0
    IEnumerator RemoveEffectTimer(SlowEffect slowEffect, float slowDuration)
    {
        //wait duration
        yield return(new WaitForSeconds(slowDuration));

        //remove effect
        effectsOnEnemy.Remove(slowEffect);
    }
示例#6
0
    public override void Effect(GameObject target)
    {
        target.GetComponent <Life>().DealDamage(damage);
        target.AddComponent <SlowEffect>();
        SlowEffect eff = target.GetComponent <SlowEffect>();

        eff.SetDuration(slowDuration);
        eff.SetSlowAmount(slowAmount);
    }
示例#7
0
 void RemoveBaseEffect(Collider mob)
 {
     //Debug.Log ("entity leaving");
     if (slowPercentage > 0)
     {
         if ((se = mob.gameObject.GetComponent <SlowEffect> ()) != null)
         {
             Component.Destroy(se);
         }
     }
 }
示例#8
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.tag == "Player" && !m_effectAdded)
     {
         other.gameObject.AddComponent <SlowEffect>();
         SlowEffect slow = other.gameObject.GetComponent <SlowEffect>();
         slow.SetDuration(m_freezeDur);
         slow.SetSlowAmount(100);
         m_effectAdded = true;
     }
 }
示例#9
0
 public void ApplyEffects(List <Node> targets, int intelligence)
 {
     for (int i = 0; i < targets.Count; ++i)
     {
         if (targets[i].Unit != null)
         {
             SlowEffect effect = new SlowEffect();
             effect.Initialize(targets[i].Unit, stats.GetStat(StatType.DURATION).Value + intelligence / stats.GetStat(StatType.DURATIONSCALING).Value);
         }
     }
 }
示例#10
0
    public void SetSpeed(float speed)
    {
        currentSpeed = speed;

        SlowEffect slowEffect = gameObject.GetComponent <SlowEffect>();

        if (slowEffect)
        {
            currentSpeed = speed * slowEffect.GetSlowAmount();
        }
    }
示例#11
0
    protected override void ApplyHitEffects(Alien alien)
    {
        SlowEffect efx = alien.gameObject.GetComponent <SlowEffect>();

        if (efx != null)
        {
            Object.Destroy(efx);
        }

        if (GameSession.Instance.isNetworkGame)
        {
            alien.slowDown(SlowTime, SlowRate);
        }
        SlowEffect fx = alien.gameObject.AddComponent <SlowEffect>();

        fx.Init(SlowTime, SlowRate);
    }
示例#12
0
    IEnumerator StartSlowRoutine(SlowEffect slow, float duration)
    {
        // float reducedSpeed = GetComponent<Unit>().currentSpeed * slow.percent;
        // GetComponent<Unit>().currentSpeed += reducedSpeed;

        //Color c = GetComponent<SpriteRenderer>().color;
        // c.b += 100;
        // GetComponent<SpriteRenderer>().color = c;

        yield return(new WaitForSeconds(duration));

        // GetComponent<Unit>().currentSpeed -= reducedSpeed;
        // c.b -= 100;
        //GetComponent<SpriteRenderer>().color = c;

        slowsEffects.Remove(slow);
    }
示例#13
0
    public void GetSlow(float slowPercentage, float slowDuration)
    {
        //do only if there is slow effect
        if (slowPercentage <= 0 || slowDuration <= 0)
        {
            return;
        }

        //add slow effect
        SlowEffect slowEffect = new SlowEffect(slowPercentage);

        effectsOnEnemy.Add(slowEffect);

        //remove effect timer
        if (gameObject.activeInHierarchy)
        {
            StartCoroutine(RemoveEffectTimer(new SlowEffect(slowPercentage), slowDuration));
        }
    }
示例#14
0
    public override object Clone()
    {
        SlowEffect instance = (SlowEffect)base.Clone();

        return(instance);
    }
示例#15
0
    void RPCSlow(float SlowTime, float SlowRate)
    {
        SlowEffect fx = gameObject.AddComponent <SlowEffect>();

        fx.Init(SlowTime, SlowRate);
    }
示例#16
0
    public void RpcAddSlowEffect()
    {
        bool slowEffectFound = false;

        foreach (StatusEffect effect in ActiveEffects)
        {
            if (effect is SlowEffect)
            {
                slowEffectFound = true;
                effect.RefreshTimer();
                break;
            }
        }

        if (!slowEffectFound)
        {
            SlowEffect slowEffect = new SlowEffect();

            ActiveEffects.Add(slowEffect);
            slowEffect.Activate(this);
        }
    }