Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Oct 30, 2017, 4:05:01 PM (7 years ago)
Author:
varxth
Message:

Started to implement change of clothes of figure after a power up.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • code/branches/SOBv2_HS17/src/modules/superorxobros/SOBFigure.cc

    r11491 r11517  
    6565        firePressed_ = false;
    6666        collDisZ_ = 0;
     67
    6768        //Times and turning
    6869        timeSinceLastFire_ = 0.0;
     
    110111            mush->hasCollided_ = true; // needed because of destroyLater takes some time and player should receive points only once
    111112
    112             Vector3 scale = {1.2, 1.2, 1.2};
    113             this->setScale3D(scale);
    114             /*if (this->hasPhysics() && this->collisionShape_ != nullptr)
     113
     114            // now, change the clothes of the Figure to red
     115            std::set<WorldEntity*> attachedObjects = this->getAttachedObjects();
     116            std::set<WorldEntity*>::iterator it;
     117            for (it = attachedObjects.begin(); it != attachedObjects.end(); ++it)
    115118            {
    116              this->collisionShape_->setScale3D(scale);
    117             }*/
    118 
     119                Model* FiguresModel = orxonox_cast<Model*>(*it);
     120                if (FiguresModel != nullptr)
     121                {
     122                    std::string name = "orxo_material_gross";
     123                    FiguresModel->setMaterial(name);
     124                }
     125            }   
    119126        }
    120127        //Check if otherObject is a Gumba (that walking enemies)
     
    136143                    gotPowerUp_ = false;
    137144                   
    138                     Vector3 scale = {1, 1, 1};
    139                     this->setScale3D(scale);
    140                     /*if (this->hasPhysics() && this->collisionShape_ != nullptr)
    141                     {
    142                      this->collisionShape_->setScale3D(scale);
    143                     }*/
    144 
     145                   // TODO: reset to old clothes of figure
     146                       // now, change the clothes of the Figure to red
     147            std::set<WorldEntity*> attachedObjects = this->getAttachedObjects();
     148            std::set<WorldEntity*>::iterator it;
     149            for (it = attachedObjects.begin(); it != attachedObjects.end(); ++it)
     150            {
     151                Model* FiguresModel = orxonox_cast<Model*>(*it);
     152                if (FiguresModel != nullptr)
     153                {
     154                    std::string name = "orxo_material";
     155                    FiguresModel->setMaterial(name);
     156                }
     157            } 
    145158                    gumba->destroyLater();
    146159                    gumba->hasCollided_ = true;
     
    269282
    270283        //If player hits space and collides against an object under him then jump
    271         if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 7.75 && collDisZ_ <+ 8.25)) {
     284        if (inputAllowed && firePressed_ && isColliding_ && (collDisZ_ >= 0 && collDisZ_ <+ 10)) {
     285        //if (inputAllowed && firePressed_ && isColliding_ ) {
     286
    272287            gravityAcceleration_ = 100.0;
    273288            velocity.z = 110;
Note: See TracChangeset for help on using the changeset viewer.