Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Ignore:
Timestamp:
Jul 17, 2005, 12:37:18 AM (19 years ago)
Author:
bensch
Message:

orxonox/branches/weaponSystem: some definitions of the Weapon

File:
1 edited

Legend:

Unmodified
Added
Removed
  • orxonox/branches/weaponSystem/src/world_entities/weapons/weapon.cc

    r4836 r4878  
    2525
    2626/**
    27  *  standard constructor
    28 
    29    creates a new weapon
     27 * standard constructor
     28 *
     29 * creates a new weapon
    3030*/
    3131Weapon::Weapon (PNode* parent, const Vector& coordinate, const Quaternion& direction)
    3232{
     33  this->init();
    3334  parent->addChild(this, PNODE_ALL);
    3435  this->setRelCoor(coordinate);
     
    3637}
    3738
    38 
    3939/**
    40  *  standard deconstructor
     40 * standard deconstructor
    4141*/
    4242Weapon::~Weapon ()
     
    5050}
    5151
     52void Weapon::init()
     53{
     54  this->currentState     = WS_INACTIVE;
     55  this->stateTime        = 0.0;
     56  for (int i = 0; i < WS_STATE_COUNT; i++)
     57  {
     58    this->times[i] = 0.0;
     59    this->animation[i] = NULL;
     60  }
     61  for (int i = 0; i < WA_ACTION_COUNT; i++)
     62    this->soundBuffers[i] = NULL;
     63
     64  this->weaponSource = NULL;
     65  this->minCharge;
     66  this->maxCharge;
     67
     68  this->active = false;
     69  this->projectile = NULL;
     70}
    5271
    5372/**
    54   *  enables the weapon
    55 
    56     a weapon can be enabled/disabled because of various reasons. if a weapon is
    57     been enabled, it can interact in a world. elswhere it wont react to any
    58     action.
    59 */
    60 void Weapon::enable()
    61 {
    62   this->enabled = true;
    63 }
    64 
    65 
    66 /**
    67   *  disables the weapon
    68 
    69     a weapon can be enabled/disabled because of various reasons. if a weapon is
    70     been enabled, it can interact in a world. elswhere it wont react to any
    71     action.
    72 */
    73 void Weapon::disable()
    74 {
    75   this->enabled = false;
    76 }
    77 
    78 
    79 /**
    80   *  checks if the weapon is enabled
    81   * @returns true if enabled
    82 
    83     a weapon can be ebabled/disabled because of various reasons. if a weapon is
    84     been enabled, it can interact in a world. elswhere it wont react to any
    85     action.
    86 */
    87 bool Weapon::isEnabled()
    88 {
    89   return this->enabled;
    90 }
    91 
    92 
    93 /**
    94  *  sets a new projectile to the weapon
     73 * sets a new projectile to the weapon
    9574 * @param new projectile for this weapon
    96 
    97    weapon an projectile are independent, so you can combine them as you want
     75 *
     76 * weapon an projectile are independent, so you can combine them as you want
    9877*/
    9978void Weapon::setProjectile(Projectile* projectile)
     
    10483
    10584/**
    106  *  sets a new projectile to the weapon
     85 * sets a new projectile to the weapon
    10786 * @returns the current projectile of this weapon
    108 
    109    weapon an projectile are independent, so you can combine them as you want
     87 *
     88 * weapon an projectile are independent, so you can combine them as you want
    11089*/
    11190Projectile* Weapon::getProjectile()
     
    11695
    11796/**
    118  *  this activates the weapon
    119 
    120    This is needed, since there can be more than one weapon on a ship. the
    121    activation can be connected with an animation. for example the weapon is
    122    been armed out.
     97 * this activates the weapon
     98 *
     99 * This is needed, since there can be more than one weapon on a ship. the
     100 * activation can be connected with an animation. for example the weapon is
     101 * been armed out.
    123102*/
    124103void Weapon::activate()
     
    127106
    128107/**
    129  *  this deactivates the weapon
    130 
    131    This is needed, since there can be more than one weapon on a ship. the
    132    activation can be connected with an animation. for example the weapon is
    133    been armed out.
     108 * this deactivates the weapon
     109 *
     110 * This is needed, since there can be more than one weapon on a ship. the
     111 * activation can be connected with an animation. for example the weapon is
     112 * been armed out.
    134113*/
    135114void Weapon::deactivate()
     
    137116
    138117/**
    139  *  asks if the current weapon is active
    140  * @returns true if it the weapon is active
    141 */
    142 bool Weapon::isActive()
    143 {}
    144 
    145 
    146 
    147 
    148 
    149 
    150 /**
    151  *  is called, when the weapon gets hit (=collide with something)
     118 * is called, when the weapon gets hit (=collide with something)
    152119 * @param from which entity it is been hit
    153120 * @param where it is been hit
    154 
    155    this may not be used, since it would make the game relay complicated when one
    156    can destroy the weapons of enemies or vice versa.
     121 *
     122 * this may not be used, since it would make the game relay complicated when one
     123 * can destroy the weapons of enemies or vice versa.
    157124*/
    158125void Weapon::hit (WorldEntity* entity, const Vector& position)
     
    162129/**
    163130 *  is called, when the weapon is destroyed
    164 
    165    this is in conjunction with the hit function, so when a weapon is able to get
    166    hit, it can also be destoryed.
     131 *
     132 * this is in conjunction with the hit function, so when a weapon is able to get
     133 * hit, it can also be destoryed.
    167134*/
    168135void Weapon::destroy ()
Note: See TracChangeset for help on using the changeset viewer.