protected void ApplyEffectsAroundPosition(Vector3 position) { var collidersInRadius = new List <Collider>(Physics.OverlapSphere(position, SplashRadius)); foreach (var col in collidersInRadius) { var target = col.transform.parent.GetComponent <Npc>(); if (target == null) { continue; } AttackEffects.ForEach(effect => effect.OnHit(Source, target)); } }
public override void Collide(Collider other, Vector3 pos) { var target = other.gameObject.GetComponentInParent <Npc>(); var tile = other.gameObject.GetComponent <Tile>(); if (target != null) { AttackEffects.ForEach(effect => effect.OnHit(Source, target)); tile = target.CurrentTile; } var offset = new Vector3(0, 0.2f + tile.GetTileHeight(), 0f); var axe = new ParticleEffectData("shred", tile.gameObject, offset, shreddingDuration); GameManager.Instance.SpecialEffectManager.PlayParticleEffect(axe); var dmg = Source.Attributes[AttributeName.AttackDamage].Value; var tileEffect = new DamageTileEffect(tile, dmg, Source); tile.SetTileEffect(tileEffect, shreddingDuration); Destroy(gameObject); }