Ejemplo n.º 1
0
        public bool isOnExplosionPath(Coords coord)
        {
            //check all live bombs and bomb radius
            //if coord is on the explosion path, return true
            //otherwise false
            foreach (Coords bomb in this.liveBombs) {
                LocationData datum = GetLocationData (bomb);
                int radius = datum.ExplosionRadius;
                bool test = (coord.Equals(bomb) || coord.isCardinalEastOf (bomb, radius) || coord.isCardinalNorthOf (bomb, radius) || coord.isCardinalSouthOf (bomb, radius) || coord.isCardinalWestOf (bomb, radius));
                if (test) {
                    return true;
                }
            }

            return false;
        }
Ejemplo n.º 2
0
        public Coords getBombOnExplosionPath(Coords coord)
        {
            //check all live bombs and bomb radius
            //if coord is on the explosion path, return the bomb that's going to explode
            //otherwise return null
            foreach (Coords bomb in this.liveBombs)
            {
                LocationData datum = GetLocationData(bomb);
                int radius = datum.ExplosionRadius;
                bool test = (coord.Equals(bomb) || coord.isCardinalEastOf(bomb, radius) || coord.isCardinalNorthOf(bomb, radius) || coord.isCardinalSouthOf(bomb, radius) || coord.isCardinalWestOf(bomb, radius));
                if (test)
                {
                    return bomb;
                }
            }

            return null;
        }