Esempio n. 1
0
        public bool HitByLazerBeam(LazerBeam beam)
        {
            if (!beam.position.IntersectsWith(this.position))
            {
                return(false);
            }

            this.health--;
            return(true);
        }
Esempio n. 2
0
        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);
        }
Esempio n. 3
0
        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);
        }