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); }
/******************** * Slow * ********************/ public void AddSlow(float percent, float duration) { SlowEffect slow = new SlowEffect(percent, duration); slow.coroutine = StartCoroutine(StartSlowRoutine(slow, duration)); slowsEffects.Add(slow); }
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()); }
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(); }
IEnumerator RemoveEffectTimer(SlowEffect slowEffect, float slowDuration) { //wait duration yield return(new WaitForSeconds(slowDuration)); //remove effect effectsOnEnemy.Remove(slowEffect); }
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); }
void RemoveBaseEffect(Collider mob) { //Debug.Log ("entity leaving"); if (slowPercentage > 0) { if ((se = mob.gameObject.GetComponent <SlowEffect> ()) != null) { Component.Destroy(se); } } }
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; } }
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); } } }
public void SetSpeed(float speed) { currentSpeed = speed; SlowEffect slowEffect = gameObject.GetComponent <SlowEffect>(); if (slowEffect) { currentSpeed = speed * slowEffect.GetSlowAmount(); } }
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); }
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); }
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)); } }
public override object Clone() { SlowEffect instance = (SlowEffect)base.Clone(); return(instance); }
void RPCSlow(float SlowTime, float SlowRate) { SlowEffect fx = gameObject.AddComponent <SlowEffect>(); fx.Init(SlowTime, SlowRate); }
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); } }