1 package cz.cuni.amis.pogamut.udk.bot.command; 2 3 import java.util.logging.Logger; 4 5 import cz.cuni.amis.pogamut.udk.bot.impl.UDKBot; 6 import cz.cuni.amis.pogamut.unreal.communication.messages.UnrealId; 7 import cz.cuni.amis.pogamut.udk.communication.messages.gbcommands.Shoot; 8 import cz.cuni.amis.pogamut.udk.communication.messages.gbcommands.StopShooting; 9 import cz.cuni.amis.pogamut.udk.communication.messages.gbinfomessages.Player; 10 11 /** 12 * Class providing Pogamut2 UT2004 simple shooting commands for the bot 13 * 14 * @author Michal 'Knight' Bida 15 */ 16 public class SimpleShooting extends BotCommands { 17 18 /** 19 * Bot will start shooting his current weapon (Issues GB SHOOT command) 20 * 21 * @see stopShoot() 22 * @see shoot(UnrealId) 23 */ 24 public void shoot() { 25 agent.getAct().act(new Shoot()); 26 } 27 28 /** 29 * Bot will start shooting with his current weapon at the target provided. 30 * (Issues GB SHOOT command) Note that the bot will track the target while 31 * shooting. If not interrupted by other command that will change bot target 32 * or that will change bot focus too much. 33 * 34 * @param target 35 * Target (that should be ILocated) the bot will shoot at. Bot 36 * will track the target, but see note above. 37 * 38 * @see stopShoot() 39 * @see shoot() 40 */ 41 public void shoot(UnrealId target) { 42 agent.getAct().act(new Shoot().setTarget(target)); 43 } 44 45 /** 46 * Bot will start shooting with his current weapon at the target provided. 47 * (Issues GB SHOOT command) Note that the bot will track the target while 48 * shooting. If not interrupted by other command that will change bot target 49 * or that will change bot focus too much. 50 * 51 * @param target 52 * Player the bot wants to shoot at. 53 * 54 * @see stopShoot() 55 * @see shoot() 56 */ 57 public void shoot(Player target) { 58 agent.getAct().act(new Shoot().setTarget(target.getId())); 59 } 60 61 /** 62 * Bot will stop shooting his current weapon (Issues GB STOPSHOOT command) 63 * 64 * @see shoot() 65 * @see shoot(UnrealId) 66 */ 67 public void stopShoot() { 68 agent.getAct().act(new StopShooting()); 69 } 70 71 /** 72 * Constructor. Setups the command module based on given agent and logger. 73 * 74 * @param agent 75 * AbstractUT2004Bot we will send commands for 76 * @param log 77 * Logger to be used for logging runtime/debug info. 78 */ 79 public SimpleShooting(UDKBot agent, Logger log) { 80 super(agent, log); 81 } 82 83 }