public bool HitByLazerBeam(LazerBeam beam) { if (!beam.position.IntersectsWith(this.position)) { return(false); } this.health--; return(true); }
private bool FindAlienHitByLazerBeamInRow(Alien[] row, LazerBeam beam) { for (int column = 0; column < row.Count(); column++) { if (row[column] != null && row[column].HitByLazerBeam(beam)) { if (row[column].health == 0) { UpdateScoreEvent.FireMyEvent(row[column].points); row[column] = null; } return(true); } } return(false); }
public bool FindAlienHitByLazerBeam(LazerBeam beam) { if (FindAlienHitByLazerBeamInRow(row_3, beam)) { return(true); } if (FindAlienHitByLazerBeamInRow(row_2, beam)) { return(true); } if (FindAlienHitByLazerBeamInRow(row_1, beam)) { return(true); } return(false); }