Question 166. You Are Designing A Single Person Shooter Game Application. The Player Can Choose Between Multiple Guns. 1) Pistol With 5 Bullets 2) Shotgun With 100 Bullets 3) Grenade Launcher With 20 Grenades Each Gun Will Have Different Sound Effects And Graphics.pressing Ctrl+space Should Rotate Between Guns.which Design Pattern Should You Employ For This?
Use Strategy Pattern. Explanation: Each gun having different performance and graphics. So this can be accomodated in the algorithm. Strategy pattern is best suited for shifting the guns/algorithms There will be a IGun interface implemented by 3 classes Pistol :IGun Shotgun :IGun GrenadeLauncher :IGun