View Javadoc

1   package cz.cuni.amis.pogamut.ut2004.bot.params;
2   
3   import cz.cuni.amis.pogamut.base.agent.IAgentId;
4   import cz.cuni.amis.pogamut.base.agent.params.IAgentParameters;
5   import cz.cuni.amis.pogamut.base.communication.connection.IWorldConnectionAddress;
6   import cz.cuni.amis.pogamut.base3d.worldview.object.Location;
7   import cz.cuni.amis.pogamut.base3d.worldview.object.Rotation;
8   import cz.cuni.amis.pogamut.ut2004.agent.params.UT2004AgentParameters;
9   
10  public class UT2004BotParameters extends UT2004AgentParameters {
11  
12  	private Integer team;
13  	private Location initialLocation;
14  	private Rotation initialRotation;
15  
16  	/**
17  	 * If you need to populate the parameters after instantiation, use setters available in this
18  	 * class: {@link UT2004BotParameters#setAgentId(IAgentId)}, {@link UT2004BotParameters#setWorldAddress(IWorldConnectionAddress)}, {@link UT2004BotParameters#setTeam(int)}.
19  	 */
20  	public UT2004BotParameters() {
21  		super();
22  	}
23  	
24  	@Override
25  	public UT2004BotParameters setAgentId(IAgentId agentId) {
26  		super.setAgentId(agentId);
27  		return this;
28  	}
29  	
30  	@Override
31  	public UT2004BotParameters setWorldAddress(IWorldConnectionAddress address) {
32  		super.setWorldAddress(address);
33  		return this;
34  	}
35  
36  	/**
37  	 * Preferred team. If illegal or no team provided, one will be
38  	 * provided for you. Normally a team game has team 0 and team 1. 
39  	 * In BotDeathMatch, team is meaningless.
40  	 * 
41  	 * @return
42  	 */
43  	public Integer getTeam() {
44  		return team;
45  	}
46  
47  	/**
48  	 * Preferred team. If illegal or no team provided, one will be
49  	 * provided for you. Normally a team game has team 0 and team 1. 
50  	 * In BotDeathMatch, team is meaningless.
51  	 * 
52  	 * @param team
53  	 * @return
54  	 */
55  	public UT2004BotParameters setTeam(Integer team) {
56  		this.team = team;
57  		return this;
58  	}
59  	
60  	public UT2004BotParameters setInitialLocation(Location location) {
61  		this.initialLocation = location;
62  		return this;
63  	}
64  	
65  	public Location getInitialLocation() {
66  		return initialLocation;
67  	}
68  	
69  	public UT2004BotParameters setInitialRotation(Rotation rotation) {
70  		this.initialRotation = rotation;
71  		return this;
72  	}
73  	
74  	public Rotation getInitialRotation() {
75  		return initialRotation;
76  	}
77  
78  	@Override
79  	public void assignDefaults(IAgentParameters defaults) {
80  		super.assignDefaults(defaults);
81  		if (defaults instanceof UT2004BotParameters) {
82  			if (team == null) {
83  				team = ((UT2004BotParameters)defaults).getTeam();
84  			}
85  			if (initialLocation == null) {
86  				initialLocation = ((UT2004BotParameters)defaults).getInitialLocation();
87  			}
88  			if (initialRotation == null) {
89  				initialRotation = ((UT2004BotParameters)defaults).getInitialRotation();
90  			}
91  		}
92  	}
93  	
94  }