Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
May 9, 2011, 2:59:07 PM (13 years ago)
Author:
decryphe
Message:
  • Moved handling of blur effect from Engine.cc to SpaceShip.cc.
  • Implemented handling of multiple engines per SpaceShip, so that in future it would be possible to turn single engines on/off individually (for example if one gets destroyed on a big ship).
  • Updated some pointers accessing the single Engine of a SpaceShip to ask the SpaceShip itself instead for data.
Location:
code/branches/bigships/src/orxonox/gametypes
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.cc

    r7284 r8426  
    151151                //Give new pig boost
    152152                SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
    153                 if (spaceship && spaceship->getEngine())
    154                 {
    155                     spaceship->getEngine()->setSpeedFactor(5);
    156                     WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
    157                     ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
    158                     executor->setDefaultValue(0, ptr);
    159                     new Timer(10, false, executor, true);
    160                 }
     153                                grantPigBoost(spaceship);
    161154            }
    162155
     
    252245                //Give new pig boost
    253246                SpaceShip* spaceship = dynamic_cast<SpaceShip*>(victim);
    254                 if (spaceship && spaceship->getEngine())
    255                 {
    256                     spaceship->getEngine()->setSpeedFactor(5);
    257                     WeakPtr<Engine>* ptr = new WeakPtr<Engine>(spaceship->getEngine());
    258                     ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
    259                     executor->setDefaultValue(0, ptr);
    260                     new Timer(10, false, executor, true);
    261                 }
    262 
     247                grantPigBoost(spaceship);
    263248            }
    264249            // killer vs piggy
     
    321306    }
    322307
     308        void Dynamicmatch::grantPigBoost(orxonox::SpaceShip* spaceship)
     309        {
     310                // Give pig boost
     311        if (spaceship)
     312        {
     313            spaceship->setSpeedFactor(5);
     314            WeakPtr<SpaceShip>* ptr = new WeakPtr<SpaceShip>(spaceship);
     315            ExecutorPtr executor = createExecutor(createFunctor(&Dynamicmatch::resetSpeedFactor, this));
     316            executor->setDefaultValue(0, ptr);
     317            new Timer(10, false, executor, true);
     318        }
     319        }
     320
    323321    void Dynamicmatch::playerStartsControllingPawn(PlayerInfo* player, Pawn* pawn) //set party + colouring
    324322    {
     
    597595    }
    598596
    599     void Dynamicmatch::resetSpeedFactor(WeakPtr<Engine>* ptr)// helper function
     597    void Dynamicmatch::resetSpeedFactor(WeakPtr<SpaceShip>* ptr)// helper function
    600598    {
    601599        if (*ptr)
  • code/branches/bigships/src/orxonox/gametypes/Dynamicmatch.h

    r7163 r8426  
    7373            virtual void furtherInstructions();*/
    7474            virtual void rewardPig();
    75             void resetSpeedFactor(WeakPtr<Engine>* ptr);
     75                        void grantPigBoost(SpaceShip* spaceship); // Added this, since it's used twice on different occasions.
     76            void resetSpeedFactor(WeakPtr<SpaceShip>* ptr);
    7677            void tick (float dt);// used to end the game
    7778            SpawnPoint* getBestSpawnPoint(PlayerInfo* player) const;
Note: See TracChangeset for help on using the changeset viewer.