Changeset 10059 for code/branches/ScriptableController
- Timestamp:
- May 15, 2014, 5:09:35 PM (11 years ago)
- Location:
- code/branches/ScriptableController
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
code/branches/ScriptableController/data/levels/levelTry.oxw
r10057 r10059 72 72 73 73 74 <Billboard position=" 500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 />75 <DistanceTrigger position=" 0,0,0" distance="200" target="Pawn"74 <Billboard position="3500,0,0" material="Flares/ringflare2" colour="0.2,0.4,0.8" scale=10 /> 75 <DistanceTrigger position="3500,0,0" distance="200" target="Pawn" 76 76 beaconMode="exclude" targetname="bcnDestroyer" name="takeControl" 77 77 /> -
code/branches/ScriptableController/src/orxonox/controllers/ControllerDirector.cc
r10057 r10059 91 91 tmp << "newctrlid = " << ctrlid; 92 92 std::string todo = tmp.str(); 93 93 94 94 /* Run the string using the luastate created earlier */ 95 95 ls->doString(todo); -
code/branches/ScriptableController/src/orxonox/controllers/ScriptController.cc
r10057 r10059 125 125 void ScriptController::tick(float dt) 126 126 { 127 128 129 127 130 /* If this controller has no entity entry, do nothing */ 128 131 if( !(this->entity_) ) … … 152 155 void ScriptController::moveToPosition_beta(float x, float y, float z ) 153 156 { 157 158 orxout()<<"moveToPosition_beta executed"<<endl; 154 159 //const Vector3 local = this->getPosition(); 155 160 const Vector3 target = Vector3(100*x,100*y,100*z); … … 158 163 159 164 160 this->entity_->lookAt(target); 161 this->entity_->moveFrontBack(-1000*target.length()); 162 163 165 //this->entity_->lookAt(target); 166 //this->entity_->moveFrontBack(-1000*target.length()); 167 168 if(this->entity_!=NULL) 169 orxout()<<"not-NULL-entity"<<endl; 170 171 if(this->player_!=NULL) 172 orxout()<<"not-NULL-player"<<endl; 173 174 orxout() << this->player_->getClientID() << endl; // IMPOSSIBLE TO ACCESS this->player AND this->entity 175 176 //this->entity_ = this->player_->getClientID();//getControllableEntity(); 177 178 //if(this->entity_==this->player_->getControllableEntity()) 179 //orxout()<<"same entity"<<endl; 180 164 181 /* This works fine */ 165 182 orxout()<<x<<" "<<y<<" "<<z<<endl; … … 168 185 void ScriptController::eventScheduler(std::string instruction, float x, float y, float z, float executionTime) 169 186 { 187 170 188 171 189 /*put data (from LUA) into time-sorted eventList*/ … … 178 196 tmp.eventTime=executionTime; 179 197 180 for(unsigned int i=0;i<eventList.size();i++) 198 orxout()<<tmp.fctName<<endl; 199 200 if(eventList.size()==0) 181 201 { 182 if(tmp.eventTime<eventList[i].eventTime) 202 orxout()<<"eventList empty (01)"<<endl; 203 eventList.insert(eventList.begin(), tmp); 204 orxout()<<"first event added"<<endl; 205 } 206 207 208 for (std::vector<event>::iterator it=eventList.begin(); it<eventList.end(); it++) 183 209 { 184 std::vector<event>::iterator it = eventList.begin(); 185 186 eventList.insert(it+(i+1),tmp); 187 break; 210 211 if(tmp.eventTime<it->eventTime) 212 { 213 eventList.insert(it,tmp); 214 orxout()<<"new event added"<<endl; 215 } 216 188 217 } 189 if(i==eventList.size()-1) 190 { 191 std::vector<event>::iterator it = eventList.end(); 192 193 eventList.insert(it,tmp); 194 195 } 196 197 } 198 218 219 220 if(eventList.size()==0) 221 orxout()<<"eventList empty"<<endl; 222 223 else 224 orxout()<<"eventList is not empty"<<endl; 225 199 226 200 227 } -
code/branches/ScriptableController/src/orxonox/controllers/ScriptController.h
r10048 r10059 64 64 void setPlayer(PlayerInfo* player) { this->player_ = player; } 65 65 66 67 66 68 //void set_luasrc(std::string); 67 69 //void set_controlled(ControllableEntity*);
Note: See TracChangeset
for help on using the changeset viewer.