0001
0002 function [pos_enemy] = getGround_TruthPos(comp_id)
0003
0004
0005
0006
0007
0008 if ischar(comp_id)
0009 comp_id = str2num(comp_id(4));
0010 end;
0011
0012 global simulationTime;
0013 global south_enemy;
0014 global north_enemy1;
0015 global north_enemy2;
0016 time_Interval_One = 91;
0017 time_Interval_Two = 93;
0018
0019 pos_enemy = [];
0020 if comp_id == 1
0021 if simulationTime < 121
0022 pos_enemy = south_enemy(simulationTime:(simulationTime+9),:);
0023 else
0024 pos_enemy = south_enemy(121:130,:);
0025 end;
0026 end;
0027
0028 if comp_id == 2
0029 if simulationTime <= time_Interval_One
0030 pos_enemy = [20.*ones(9,1) 164.*ones(9,1)];
0031 return;
0032 end;
0033 if (simulationTime < time_Interval_Two)&& (simulationTime > time_Interval_One)
0034 pos_enemy = north_enemy1((simulationTime - time_Interval_One):((simulationTime - time_Interval_One)+9),:);
0035 end;
0036 if simulationTime == time_Interval_Two
0037 pos_enemy = north_enemy2(1:9,:);
0038 end;
0039 if simulationTime > time_Interval_Two
0040 pos_enemy = north_enemy2((simulationTime - time_Interval_Two):((simulationTime - time_Interval_Two)+9),:);
0041 end;
0042 end;
0043
0044 if comp_id == 3
0045 if simulationTime <= time_Interval_One
0046 pos_enemy = [33.*ones(9,1) 159.*ones(9,1)];
0047 else
0048 pos_enemy = north_enemy2((simulationTime - time_Interval_One):((simulationTime - time_Interval_One)+9),:);
0049 end;
0050 end;
0051
0052 if isempty(pos_enemy)
0053 disp('ERROR: in getGround_TruthPos: no position returned')
0054 disp('getGround_TruthPos: comp_id '), comp_id
0055 end;
0056
0057
0058
0059
0060
0061
0062
0063