Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 5435 in orxonox.OLD for trunk/src/world_entities/player.cc


Ignore:
Timestamp:
Oct 25, 2005, 5:31:54 PM (19 years ago)
Author:
bensch
Message:

orxonox/trunk: power-ups implemented (simple-mode)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/player.cc

    r5420 r5435  
    9292  wpLeft->setName("testGun Left");
    9393
    94   Weapon* turret1 = new Turret(this->weaponMan);
    95   turret1->setName("Turret1");
    96   turret1->setStateDuration(WS_SHOOTING, .2);
    97   Weapon* turret2 = new Turret(this->weaponMan);
    98   turret2->setName("Turret2");
    99   turret2->setStateDuration(WS_SHOOTING, .3);
    100   Weapon* turret3 = new Turret(this->weaponMan);
    101   turret3->setName("Turret3");
    102   turret3->setStateDuration(WS_SHOOTING, .17);
    103 
    104   Weapon* turret4 = new Turret(this->weaponMan);
    105   turret4->setName("Turret4");
    106   turret4->setStateDuration(WS_SHOOTING, .3);
    107 
    108 
    10994  this->weaponMan->addWeapon(wpLeft, 1, 0);
    11095  this->weaponMan->addWeapon(wpRight,1 ,1);
    111   this->weaponMan->addWeapon(turret1, 2, 2);
    112   this->weaponMan->addWeapon(turret2, 2, 3);
    113   this->weaponMan->addWeapon(turret3, 2, 4);
    114   this->weaponMan->addWeapon(turret4, 2, 5);
    115 
    11696  //this->weaponMan->addWeapon(turret, 3, 0);
    11797
    118   this->weaponMan->changeWeaponConfig(0);
     98  this->weaponMan->changeWeaponConfig(1);
    11999}
    120100
     
    153133
    154134  this->weaponMan = new WeaponManager(this);
    155   this->weaponMan->setSlotCount(6);
     135  this->weaponMan->setSlotCount(10);
    156136
    157137  this->weaponMan->setSlotPosition(0, Vector(-2.6, .1, -3.0));
     
    171151  this->weaponMan->setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
    172152
     153  this->weaponMan->setSlotPosition(6, Vector(-2.0, 0.1, -2.0));
     154  this->weaponMan->setSlotPosition(7, Vector(-2.0, 0.1, 2.0));
     155
     156  this->weaponMan->setSlotPosition(8, Vector(-2.5, -0.3, -2.0));
     157  this->weaponMan->setSlotDirection(8, Quaternion(-M_PI, Vector(1,0,0)));
     158
     159  this->weaponMan->setSlotPosition(9, Vector(-2.5, -0.3, 2.0));
     160  this->weaponMan->setSlotDirection(9, Quaternion(+M_PI, Vector(1,0,0)));
     161
    173162}
    174163
     
    222211
    223212
    224 
    225 /**
    226  *  if the player is hit, call this function
    227  * @param weapon hit by this weapon
    228  * @param loc ??
    229 */
    230 void Player::hit (WorldEntity* weapon, Vector* loc)
    231 {
    232 }
    233 
    234 
    235 /**
    236   *  Collision with another Entity has this effect
    237   * @param other the other colider
    238   * @param ownhitflags ??
    239   * @param otherhitflags ??
    240 */
    241 void Player::collide (WorldEntity* other, Uint32 ownhitflags, Uint32 otherhitflags)
    242 {
    243 }
    244 
     213WorldEntity* ref = NULL;
     214/**
     215 *  this function is called, when two entities collide
     216 * @param entity: the world entity with whom it collides
     217 *
     218 * Implement behaviour like damage application or other miscellaneous collision stuff in this function
     219 */
     220void Player::collidesWith(WorldEntity* entity, const Vector& location)
     221{
     222  if (entity->isA(CL_TURRET_POWER_UP) && entity != ref)
     223  {
     224    this->ADDWEAPON();
     225    ref = entity;
     226    }
     227//  PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getClassName(), entity->getClassName(), location.x, location.y, location.z);
     228}
    245229
    246230/**
     
    343327    this->weaponMan->previousWeaponConfig();
    344328}
     329
     330// FIXME THIS MIGHT BE CONSIDERED EITHER A FEATURE, OR A BUG
     331int slot = 2;
     332void Player::ADDWEAPON()
     333{
     334  Weapon* turret1 = new Turret(this->weaponMan);
     335  turret1->setName("Turret");
     336  turret1->setStateDuration(WS_SHOOTING, (float)rand()/RAND_MAX*.5+.1);
     337
     338  this->weaponMan->addWeapon(turret1, 2, slot++);
     339
     340  this->weaponMan->changeWeaponConfig(2);
     341}
Note: See TracChangeset for help on using the changeset viewer.