Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 10268 in orxonox.OLD for branches/ai/src/world_entities/npcs/npc.cc


Ignore:
Timestamp:
Jan 17, 2007, 5:15:00 PM (18 years ago)
Author:
patrick
Message:

now npcs should be able to shoot

File:
1 edited

Legend:

Unmodified
Added
Removed
  • branches/ai/src/world_entities/npcs/npc.cc

    r10263 r10268  
    2323#include "ai_swarm.h"
    2424#include "ai_engine.h"
     25
     26#include "debug.h"
    2527
    2628#include "loading/load_param.h"
     
    7476
    7577
     78/**
     79 * @brief adds a Weapon to the NPC.
     80 * @param weapon the Weapon to add.
     81 * @param configID the Configuration ID to add this weapon to.
     82 * @param slotID the slotID to add the Weapon to.
     83 */
     84bool NPC::addWeapon(Weapon* weapon, int configID, int slotID)
     85{
     86  weapon->setOwner(this->getOwner());
     87
     88
     89  if(this->weaponMan.addWeapon(weapon, configID, slotID))
     90  {
     91    return true;
     92  }
     93  else
     94  {
     95    if (weapon != NULL)
     96      PRINTF(2)("Unable to add Weapon (%s::%s) to %s::%s\n",
     97                weapon->getClassCName(), weapon->getCName(), this->getClassCName(), this->getCName());
     98    else
     99      PRINTF(2)("No weapon defined\n");
     100    return false;
     101
     102  }
     103}
     104
     105/**
     106 * @brief removes a Weapon.
     107 * @param weapon the Weapon to remove.
     108 */
     109void NPC::removeWeapon(Weapon* weapon)
     110{
     111  this->weaponMan.removeWeapon(weapon);
     112
     113}
     114
     115/**
     116 * @brief jumps to the next WeaponConfiguration
     117 */
     118void NPC::nextWeaponConfig()
     119{
     120  this->weaponMan.nextWeaponConfig();
     121}
     122
     123/**
     124 * @brief moves to the last WeaponConfiguration
     125 */
     126void NPC::previousWeaponConfig()
     127{
     128  this->weaponMan.previousWeaponConfig();
     129}
     130
     131
     132
     133
     134/**
     135 * ticking
     136 * @param dt  time since last tick
     137 */
    76138void NPC::tick(float dt)
    77139{
     
    79141  if (this->bFire)
    80142    weaponMan.fire();
     143  this->bFire = false;
    81144}
Note: See TracChangeset for help on using the changeset viewer.