private void OnTriggerStay(Collider other) { SlowDebuff slowDebuff = other.gameObject.GetComponent <SlowDebuff>(); if (slowDebuff == null) { slowDebuff = (SlowDebuff)other.gameObject.AddComponent(typeof(SlowDebuff)); } slowDebuff.ResetDebuff(_slowDuration, _slowAmount); }
void TakeSlowDamage() { if (slowDebuff != null) { slowDebuff.timer -= Time.deltaTime; if (slowDebuff.timer <= 0) { slowDebuff = null; currentSpeed = speed; } } }
public void TakeSlowDebuff(SlowCube sc) { SlowDebuff newSlowDebuff = new SlowDebuff { attackType = sc.attackType, duration = sc.slowDuration, timer = sc.slowDuration }; if (slowDebuff == null || newSlowDebuff > slowDebuff) { slowDebuff = newSlowDebuff; currentSpeed = speed * slowDebuff.slowPercent; } }
void Start() { totalHp = hp; currentSpeed = speed; stunned = false; firingDebuff = null; slowDebuff = null; stunDebuff = null; hpSlider = GetComponentInChildren <Slider>(); agent = GetComponent <NavMeshAgent>(); agent.speed = currentSpeed; agent.destination = GameObject.Find("End").GetComponent <Transform>().position; gameManager.SubscribeEnemyKilled(this); gameManager.SubscribeEnemyReach(this); Player.currentPlayer.SubscribeEnemyKilled(this); }