public void AddDebuff(Debuff debuff) { if (!debuffsToAdd.Exists(x => x.GetType() == debuff.GetType())) { debuffsToAdd.Add(debuff); if (debuffs.Exists(x => x.GetType() == debuff.GetType())) { debuffs.Find(x => x.GetType() == debuff.GetType()).Remove(); } } }
public void RemoveDebuff(Debuff debuff) { if (!debuffsToRemove.Exists(x => x.GetType() == debuff.GetType())) { debuffsToRemove.Add(debuff); } }
public void AddDebuff(Debuff debuff) { if (!debuffs.Exists(x => x.GetType() == debuff.GetType())) // Looks through the debuffs list, and for each x element in the list, check to see if that element's debuff type is equivalent to the method argument's debuff type { newDebuffs.Add(debuff); } }
private GameObject FindClosestNoDebuff() { GameObject[] enemies; enemies = GameObject.FindGameObjectsWithTag("Enemy"); GameObject closest = null; float distance = tower.range * rangeMultiplier; Vector3 position = transform.position; foreach (GameObject potentialTarget in enemies) { float _distance = Vector2.Distance(potentialTarget.transform.position, position); if (_distance < distance) { EnemyAI enemyAI = potentialTarget.GetComponent <EnemyAI>(); if (enemyAI != null) { if (!enemyAI.debuffs.Exists(x => x.GetType() == debuff.GetType())) { closest = potentialTarget; distance = _distance; } } } } if (!closest) { closest = FindClosestEnemy(); } return(closest); }
public void AddDebuff(Debuff debuff) { if (!debuffs.Exists(x => x.GetType() == debuff.GetType())) { newDebuffs.Add(debuff); } }
public void AddDebuff(Debuff debuff) { if (!debuffs.Exists(x => x.GetType() == debuff.GetType())) //check if debuff is new or not only apply if it is { newDebuffs.Add(debuff); } }
public void AddDebuff(Debuff debuff) { if (!debuffs.Exists(x => x.GetType() == debuff.GetType()) && !newDebuffs.Exists(x => x.GetType() == debuff.GetType())) // prevents same type of debuffs stacking { //Debuffs are first added to the list newDebuffs newDebuffs.Add(debuff); } }
public void AddDebuff(Debuff debuff) { if (!debuffs.Exists(x => x.GetType() == debuff.GetType())) //몬스터 타입과 타워의 타입이 같으면 디버프가 들어가지않음 { newDebuffs.Add(debuff); } }
/// <summary> /// Adds a debuff to the monster /// </summary> /// <param name="debuff">The type of debuff to add</param> public void AddDebuff(Debuff debuff) { //Checks if the debuff already exists before adding it //If it doesn't exist then we add it if (!debuffs.Exists(x => x.GetType() == debuff.GetType())) { //Adds the debuff to new debuffs newDebuffs.Add(debuff); } }
public void AddDebuff(Debuff debuff) { foreach (Debuff d in debuffs) { if (d.GetType().Equals(debuff.GetType())) { d.AddIntensity(debuff.intensity); return; } } debuffs.Add(debuff); }