private void OnTargetEntersRange(EntityTargetable target) { EntityEnemy enemy = target as EntityEnemy; if (enemy == null) { return; } enemy.ApplySlow(entityDataTower.Tower.SerialId, entityDataTower.Tower.SpeedDownRate); slowList.Add(enemy); enemy.OnDead += RemoveSlowTarget; enemy.OnHidden += RemoveSlowTarget; }
private void RemoveSlowTarget(EntityTargetable target) { EntityEnemy enemy = target as EntityEnemy; if (enemy == null) { return; } enemy.RemoveSlow(entityDataTower.Tower.SerialId); enemy.OnDead -= RemoveSlowTarget; enemy.OnHidden -= RemoveSlowTarget; slowList.Remove(enemy); }
void OnTriggerEnter(Collider other) { EntityEnemy enemy = other.gameObject.GetComponent <EntityEnemy>(); if (enemy == null) { return; } if (!enemy.IsDead) { enemy.Damage(entityDataProjectile.ProjectileData.Damage); } int number = Physics.OverlapSphereNonAlloc(transform.position, entityDataProjectile.ProjectileData.SplashRange, s_Enemies, mask); for (int index = 0; index < number; index++) { Collider collider = s_Enemies[index]; var rangeEnemy = collider.GetComponent <EntityEnemy>(); if (rangeEnemy == null) { continue; } if (!enemy.IsDead) { rangeEnemy.Damage(entityDataProjectile.ProjectileData.SplashDamage); } } SpawnCollisionParticles(); if (!hide) { GameEntry.Event.Fire(this, HideEntityInLevelEventArgs.Create(Entity.Id)); hide = true; } }