- Timestamp:
- Nov 27, 2015, 7:58:44 PM (8 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/campaignHS15/src/orxonox/controllers/WingmanController.cc
r10877 r10879 71 71 Action::FIGHTALL && this->myLeader_->getAction() != Action::ATTACK) 72 72 { 73 } 74 75 SUPER(WingmanController, tick, dt); 76 } 77 78 //----action for hard calculations---- 79 void WingmanController::action() 80 { 81 82 //----If no leader, find one---- 83 if (!this->myLeader_) 84 { 85 ActionpointController* newLeader = (findNewLeader()); 86 this->myLeader_ = newLeader; 87 if (this->myLeader_) 88 { 89 90 } 91 } 92 //----If have leader, he will deal with logic---- 93 else 94 { 95 96 } 97 if (!this->myLeader_) 98 { 99 ActionpointController::action(); 100 } 101 else if (this->myLeader_) 102 { 103 switch (this->myLeader_->getAction()) 104 { 105 case Action::FIGHT: 106 { 107 if (!this->hasTarget()) 108 { 109 this->setTarget(this->myLeader_->getTarget()); 110 } 111 break; 112 } 113 case Action::FIGHTALL: 114 { 115 if (!this->hasTarget()) 116 { 117 this->setTarget(this->myLeader_->getTarget()); 118 } 119 break; 120 } 121 case Action::ATTACK: 122 { 123 if (!this->hasTarget()) 124 { 125 this->setTarget(this->myLeader_->getTarget()); 126 } 127 break; 128 } 129 default: 130 { 131 73 132 ControllableEntity* myEntity = this->getControllableEntity(); 74 133 Vector3 myPosition = myEntity->getWorldPosition(); … … 80 139 Quaternion orient = leaderEntity->getWorldOrientation(); 81 140 Vector3 leaderPosition = leaderEntity->getWorldPosition(); 82 83 141 Vector3 targetRelativePosition = getFormationPosition(); 84 142 if (!this->myLeader_) … … 99 157 this->getControllableEntity()->boost(false); 100 158 } 101 }102 103 SUPER(WingmanController, tick, dt);104 }105 106 //----action for hard calculations----107 void WingmanController::action()108 {109 110 //----If no leader, find one----111 if (!this->myLeader_)112 {113 ActionpointController* newLeader = (findNewLeader());114 this->myLeader_ = newLeader;115 116 }117 //----If have leader, he will deal with logic----118 else119 {120 121 }122 if (!this->myLeader_)123 {124 ActionpointController::action();125 }126 else if (this->myLeader_)127 {128 switch (this->myLeader_->getAction())129 {130 case Action::FIGHT:131 {132 if (!this->hasTarget())133 {134 this->setTarget(this->myLeader_->getTarget());135 }136 break;137 }138 case Action::FIGHTALL:139 {140 if (!this->hasTarget())141 {142 this->setTarget(this->myLeader_->getTarget());143 }144 break;145 }146 case Action::ATTACK:147 {148 if (!this->hasTarget())149 {150 this->setTarget(this->myLeader_->getTarget());151 }152 break;153 }154 default:155 {156 157 159 } 158 160 } … … 179 181 case FormationMode::WALL: 180 182 { 181 targetRelativePosition = new Vector3 (2*this->spread_, 0, 0 );183 targetRelativePosition = new Vector3 (2*this->spread_, 0, 0 - this->tolerance_); 182 184 break; 183 185 } 184 186 case FormationMode::FINGER4: 185 187 { 186 targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ );188 targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ - this->tolerance_); 187 189 break; 188 190 } 189 191 case FormationMode::DIAMOND: 190 192 { 191 targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ );193 targetRelativePosition = new Vector3 (2*this->spread_, 0, this->spread_ - this->tolerance_); 192 194 break; 193 195 } … … 200 202 case FormationMode::WALL: 201 203 { 202 targetRelativePosition = new Vector3 (-2*this->spread_, 0, 0 );204 targetRelativePosition = new Vector3 (-2*this->spread_, 0, 0 - this->tolerance_); 203 205 break; 204 206 } 205 207 case FormationMode::FINGER4: 206 208 { 207 targetRelativePosition = new Vector3 (-2*this->spread_, 0, this->spread_ );209 targetRelativePosition = new Vector3 (-2*this->spread_, 0, this->spread_ - this->tolerance_); 208 210 break; 209 211 } 210 212 case FormationMode::DIAMOND: 211 213 { 212 targetRelativePosition = new Vector3 (2*this->spread_, -this->spread_, 0 );214 targetRelativePosition = new Vector3 (2*this->spread_, -this->spread_, 0 - this->tolerance_); 213 215 break; 214 216 }
Note: See TracChangeset
for help on using the changeset viewer.