public override void Effect(Vector3 pos, ref List <Enemy> enemies, ref Bullet.Flags flags)
    {
        var nearby = Physics
                     .SphereCastAll(pos, radius, Vector3.up)
                     .Select(thing => thing.collider.GetComponent <Enemy>())
                     .Where(e => e != null);

        enemies.AddRange(nearby);
    }
Esempio n. 2
0
 public override void Effect(Vector3 vel, ref List <Enemy> enemies, ref Bullet.Flags flags)
 {
     Debug.Log($"Knockback Effect called, with {enemies.Count} enemies");
     enemies.ForEach(enemy =>
     {
         var rb  = enemy.GetComponent <Rigidbody>();
         var dir = vel.normalized;
         rb.AddForce(dir * knockbackForce);
         Debug.Log($"Knocking back, " +
                   $"enemy: {enemy}, " +
                   $"pos: {dir}, " +
                   $"dir: {dir}");
     });
 }
Esempio n. 3
0
 public abstract void Effect(Vector3 pos, ref List <Enemy> enemy, ref Bullet.Flags flags);
 public override void Effect(Vector3 pos, ref List <Enemy> enemies, ref Bullet.Flags flags)
 {
     enemies.ForEach(enemy => enemy.TakeDamage(damage));
 }
Esempio n. 5
0
 public override void Effect(Vector3 pos, ref List <Enemy> enemy, ref Bullet.Flags flags)
 {
     Debug.Log("Shocking");
 }
Esempio n. 6
0
 public override void Effect(Vector3 pos, ref List <Enemy> enemies, ref Bullet.Flags flags)
 {
     enemies.ForEach(enemy => enemy.Ignite());
 }
 public override void Effect(Vector3 pos, ref List <Enemy> enemy, ref Bullet.Flags flags)
 {
     flags |= Bullet.Flags.supressDestroy;
 }