//Creates a basic attack at the given enemy public void Attack() { List <DamageValues> dmgs = new List <DamageValues>(); if (grid.attackDirection == Constants.Direction.LEFT) { dmgs = battleController.enemyController.GetRandomEnemies(1, 5, true, true); } else if (grid.attackDirection == Constants.Direction.RIGHT) { dmgs = battleController.enemyController.GetRandomEnemies(1, 5, true, false); } foreach (DamageValues dv in dmgs) { if (dmgs == null) { continue; } Transform shotTransform = Instantiate(starProjectile) as Transform; Projectile projectile = shotTransform.GetComponent <Projectile>(); projectile.SetDamage(dv.GetDamage(), soldierAttack.value, 1); projectile.multiHit = true; shotTransform.position = dv.entityHit.position + new Vector3(Random.Range(-0.25f, 0.25f), Random.Range(-0.25f, 0.25f), 0); balanceController.TriggerNormal(); } if (dmgs.Count > 0) { currentSfx.value.Enqueue(basicActivationSound.clip); playSfxEvent.Invoke(); } }