Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 26, 2016, 3:54:24 PM (8 years ago)
Author:
plehmann
Message:

implemented the update function of MoveToTask. but it does not yet work right. it might be more a problem of the controllerDirector than the task.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/plehmannFS16/src/orxonox/controllers/NewScriptController.cc

    r11190 r11204  
    4646#include "scriptTasks/DebugTask.h"
    4747#include "scriptTasks/stringOutTask.h"
     48#include "scriptTasks/MoveToTask.h"
    4849#include "scriptTasks/Task.h"
    4950#include "infos/PlayerInfo.h"
     
    102103        this->setControllableEntity(this->entity_);
    103104        this->entity_->mouseLook();
    104         this->entity_->setVisible(false);
     105        this->entity_->setVisible(true);
    105106       
    106107        // TODO take the human Controllers control  dont forget to give it back in the destructor
     
    116117        // If this controller has no entity entry, do nothing
    117118        if( !(this->entity_) ) return;
    118 
    119 
    120 /*
    121         if(taskQueue_.front()->getStartTime() <= scTime_)
    122         {
    123           activeTasks_.push_back(taskQueue_.front());
    124           taskQueue_.pop();
    125         }
    126 
    127         for(Task* task : activeTasks_)
    128         {
    129           task->tick(dt);
    130         }*/
    131119
    132120        if(!this->taskList_.empty())
     
    211199
    212200      task->initialize(startTime, output);
     201
     202      bool inserted = false;
     203
     204      if(taskList_.empty())
     205      {
     206        taskList_.push_front(task);
     207        inserted = true;
     208      }
     209
     210      else
     211      {
     212        for (std::list<Task*>::iterator it = taskList_.begin(); it != taskList_.end(); it++) // insert sorted by starttime
     213        {
     214          orxout() << "stringOutTask" << endl;
     215
     216          if(task->getStartTime() < (*it)->getStartTime() )
     217          {
     218            taskList_.insert(it, task);
     219            inserted = true;
     220            break;
     221          }
     222        }
     223      }
     224
     225      if (!inserted)
     226      {
     227        taskList_.push_back(task);
     228      }
     229
     230    }
     231
     232    void NewScriptController::moveTo(float startTime, float x, float y, float z, float velocity)
     233    {
     234
     235      MoveToTask* task = new MoveToTask(context_);
     236
     237      Vector3 destination = Vector3(x,y,z);
     238
     239      task->initialize(startTime, player_, destination, velocity);
    213240
    214241      bool inserted = false;
Note: See TracChangeset for help on using the changeset viewer.