public override void OnAbilityConnected(GameObject obj) { var rangeComponent = new SelfAndConstantRange(obj, Owner.Board, this); rangeComponent.range = this.AreaOfEffect; Explode(rangeComponent); }
private void Explode(SelfAndConstantRange rangeComponent) { // range component is calculating range based on owner pos, rather than projectile pos var tiles = rangeComponent.GetTilesInRange(); tiles.Where(data => data.tile.IsOccupied()) .Select(data => data.tile.OccupiedBy).ToList() .ForEach(unit => { unit.HealthComponent.AdjustHealth(-Damage); }); tiles.ForEach(tile => { var vfx = Instantiate(Resources.Load <GameObject> ("Prefabs/Player Impact Visual"), new Vector3(tile.tile.Position.x, tile.tile.Position.y, Layers.Foreground), Quaternion.identity); Destroy(vfx, 0.2f); }); AudioComponent.PlaySound(Sounds.BOMB); }