Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Dec 21, 2005, 3:09:37 PM (19 years ago)
Author:
manuel
Message:

powerup: merged old powerups into new trunk framework

Location:
branches/powerups/src/world_entities/space_ships
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/powerups/src/world_entities/space_ships/space_ship.cc

    r6222 r6233  
    3131#include "key_mapper.h"
    3232#include "event_handler.h"
     33
     34#include "power_ups/weapon_power_up.h"
     35#include "power_ups/param_power_up.h"
    3336
    3437#include "graphics_engine.h"
     
    430433  else if ( event.type == KeyMapper::PEV_PREVIOUS_WEAPON && event.bPressed)
    431434    this->getWeaponManager()->previousWeaponConfig();
    432 
    433435  else if( event.type == SDLK_w)
    434436    this->bUp = event.bPressed; //this->shiftCoor(0,.1,0);
     
    443445     this->setAbsDir(mouseDir);
    444446  }
     447}
     448
     449/**
     450 *
     451 */
     452bool SpaceShip::pickup(PowerUp* powerUp)
     453{
     454  if(powerUp->isA(CL_WEAPON_POWER_UP)) {
     455    Weapon* weapon = dynamic_cast<WeaponPowerUp*>(powerUp)->getWeapon();
     456    WeaponManager* manager = this->getWeaponManager();
     457    int slot = manager->getNextFreeSlot(0, weapon->getCapability());
     458    if(slot >= 0) {
     459      manager->addWeapon(weapon, 0, slot);
     460      return true;
     461    }
     462  }
     463  else if(powerUp->isA(CL_PARAM_POWER_UP)) {
     464    ParamPowerUp* ppu = dynamic_cast<ParamPowerUp*>(powerUp);
     465    switch(ppu->getType()) {
     466      case PARAM_SHIELD:
     467        break;
     468    }
     469  }
     470  return false;
    445471}
    446472
  • branches/powerups/src/world_entities/space_ships/space_ship.h

    r6222 r6233  
    88
    99#include "playable.h"
     10#include "extendable.h"
    1011
    1112
     
    1415class Event;
    1516
    16 class SpaceShip : public Playable
     17class SpaceShip : public Playable, public Extendable
    1718{
    1819
     
    4142
    4243    virtual void process(const Event &event);
    43 
     44    bool pickup(PowerUp* powerUp);
    4445
    4546
Note: See TracChangeset for help on using the changeset viewer.