View Javadoc

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.IUDKBotController;
6   import cz.cuni.amis.pogamut.udk.bot.impl.UDKBot;
7   
8   /**
9    * Creates and wraps all available command modules. These command modules
10   * contains documented methods that wraps Pogamut commands. For example simple
11   * locomotion provides methods for basic bot movement in the environment.
12   * <p><p>
13   * It is designed to be initialized inside {@link IUDKBotController#prepareBot(UDKBot)} method call
14   * and may be used since since the first {@link IUDKBotController#botSpawned(cz.cuni.amis.pogamut.ut2004.communication.messages.gbinfomessages.GameInfo, ConfigChange, InitedMessage, Self)} 
15   * is called.
16   * 
17   * @author Knight
18   */
19  public class CompleteBotCommandsWrapper {
20  
21  	// Pointers to command modules, will be initialized in the constructor.
22  
23  	Action action;
24  
25  	AdvancedLocomotion locomotion;
26  
27  	AdvancedShooting shooting;
28  
29  	Communication communication;
30  
31  	ConfigureCommands configureCommands;
32  
33  	SimpleRayCasting simpleRayCasting;
34  
35  	/**
36  	 * Returns {@link cz.cuni.amis.pogamut.ut2004.bot.commands.Action} command
37  	 * module.
38  	 * 
39  	 * @return action command module
40  	 */
41  	public Action getAction() {
42  		return action;
43  	}
44  
45  	/**
46  	 * Returns
47  	 * {@link cz.cuni.amis.pogamut.ut2004.bot.commands.AdvancedLocomotion}
48  	 * command module.
49  	 * 
50  	 * @return advanced locomotion command module
51  	 */
52  	public AdvancedLocomotion getLocomotion() {
53  		return locomotion;
54  	}
55  
56  	/**
57  	 * Returns {@link cz.cuni.amis.pogamut.ut2004.bot.commands.AdvancedShooting}
58  	 * command module.
59  	 * 
60  	 * @return advanced shooting command module
61  	 */
62  	public AdvancedShooting getShooting() {
63  		return shooting;
64  	}
65  
66  	/**
67  	 * Returns {@link cz.cuni.amis.pogamut.ut2004.bot.commands.Communication}
68  	 * command module.
69  	 * 
70  	 * @return communication command module
71  	 */
72  	public Communication getCommunication() {
73  		return communication;
74  	}
75  
76  	/**
77  	 * Returns
78  	 * {@link cz.cuni.amis.pogamut.ut2004.bot.commands.ConfigureCommands}
79  	 * command module.
80  	 * 
81  	 * @return configure commands command module
82  	 */
83  	public ConfigureCommands getConfigureCommands() {
84  		return configureCommands;
85  	}
86  
87  	/**
88  	 * Returns {@link cz.cuni.amis.pogamut.ut2004.bot.commands.SimpleRayCasting}
89  	 * command module.
90  	 * 
91  	 * @return simple ray casting command module
92  	 */
93  	public SimpleRayCasting getSimpleRayCasting() {
94  		return simpleRayCasting;
95  	}
96  	
97  	/**
98  	 * Constructor. Setups the command module based on given agent.
99  	 * 
100 	 * @param agent
101 	 *            AbstractUT2004Bot we will send commands for
102 	 */
103 	public CompleteBotCommandsWrapper(UDKBot agent) {
104 		this(agent, null);
105 	}
106 
107 	/**
108 	 * Constructor. Setups the command module based on given agent and logger.
109 	 * 
110 	 * @param agent
111 	 *            AbstractUT2004Bot we will send commands for
112 	 * @param log
113 	 *            Logger to be used for logging runtime/debug info.
114 	 */
115 	public CompleteBotCommandsWrapper(UDKBot agent, Logger log) {
116 
117 		// initialize command modules
118 		action = new Action(agent, log);
119 		locomotion = new AdvancedLocomotion(agent, log);
120 		shooting = new AdvancedShooting(agent, log);
121 		communication = new Communication(agent, log);
122 		configureCommands = new ConfigureCommands(agent, log);
123 		simpleRayCasting = new SimpleRayCasting(agent, log);
124 	}
125 }