Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 8724 in orxonox.OLD for trunk/src/world_entities/npcs


Ignore:
Timestamp:
Jun 22, 2006, 3:14:58 PM (19 years ago)
Author:
bensch
Message:

merged the bsp-model-stuff back here

Location:
trunk/src/world_entities/npcs
Files:
5 edited
2 copied

Legend:

Unmodified
Added
Removed
  • trunk/src/world_entities/npcs/ground_turret.cc

    r7954 r8724  
    3939 */
    4040GroundTurret::GroundTurret(const TiXmlElement* root)
     41  : NPC(root)
    4142{
    4243  this->init();
  • trunk/src/world_entities/npcs/npc.cc

    r7076 r8724  
    1919
    2020#include "npc.h"
    21 #include "obb_tree.h"
    2221
    23 #include "state.h"
    24 #include "stdlibincl.h"
    25 #include "power_ups/turret_power_up.h"
    26 #include "power_ups/laser_power_up.h"
    2722
    2823using namespace std;
    2924
    3025
    31 NPC::NPC()
     26NPC::NPC(const TiXmlElement* root)
    3227{
    3328  this->setClassID(CL_NPC, "NPC");
     29
    3430  this->toList(OM_GROUP_00);
    3531}
     
    3935
    4036
    41 void NPC::collidesWith(WorldEntity* entity, const Vector& location)
    42 {
    4337
    44   if (entity == collider)
    45     return;
    46   collider = entity;
    47 
    48   if (entity->isA(CL_PROJECTILE))
    49   {
    50     this->decreaseHealth(entity->getHealth() *(float)rand()/(float)RAND_MAX);
    51     // EXTREME HACK
    52     if (this->getHealth() <= 0.0f)
    53     {
    54       this->destroy();
    55     }
    56   }
     38/**
     39 * adds an AI to this NPC
     40 */
     41void NPC::addAI(AI* ai)
     42{}
    5743
    5844
    59 // //    PRINTF(3)("collision %s vs %s @ (%f,%f,%f)\n", this->getName(), entity->getName(), location.x, location.y, location.z);
    60 // //    this->applyForce(Vector(0,0,0)-location*1000);
    61 //     if ((float)rand()/RAND_MAX < .3)
    62 //     {
    63 //       WorldEntity* powerUp = new TurretPowerUp();
    64 //       powerUp->setAbsCoor(this->getAbsCoor());
    65 // //      powerUp->toList(OM_COMMON);
    66 //     }
    67 //     else if ((float)rand()/RAND_MAX < .3)
    68 //     {
    69 //       WorldEntity* powerUp = new LaserPowerUp();
    70 //       powerUp->setAbsCoor(this->getAbsCoor());
    71 //       powerUp->toList(OM_COMMON);
    72 //     }
    73 //     this->toList(OM_DEAD);
    74 //     this->removeNode();
    75 //
    76 //       this->collider = entity;
    77 //   }
    78 //   //  else if (entity->isA(CL_PLAYER))
    79 //   //    this->applyForce(Vector(0,0,0)-location*100);
    80 //   else if (entity->isA(CL_NPC))
    81 //   {
    82 //     this->setVisibiliy(false);
    83 //     this->toList(OM_DEAD);
    84 //     this->removeNode();
    85 //   }
     45
     46/**
     47 * loads the xml tags
     48 * @param root: root xml tag for this element
     49 */
     50void NPC::loadParams(const TiXmlElement* root)
     51{
     52  WorldEntity::loadParams(root);
    8653}
     54
  • trunk/src/world_entities/npcs/npc.h

    r6981 r8724  
    44
    55#include "world_entity.h"
    6 #include "physics_interface.h"
    76
    87class AI;
     
    1110
    1211 public:
    13   NPC ();
     12   NPC (const TiXmlElement* root);
    1413  virtual ~NPC ();
    1514
     15  virtual void loadParams(const TiXmlElement* root = NULL);
    1616
    1717  void addAI(AI* ai);
    18 
    19   virtual void collidesWith (WorldEntity* entity, const Vector& location);
    2018
    2119
    2220 private:
    2321
    24    WorldEntity* collider;
    25 
    2622};
    2723
  • trunk/src/world_entities/npcs/npc_test.cc

    r6222 r8724  
    3131
    3232NPC2::NPC2()
     33  : NPC(NULL)
    3334{
    3435  this->setClassID(CL_NPC_TEST2, "NPC2");
  • trunk/src/world_entities/npcs/npc_test1.cc

    r6222 r8724  
    2929
    3030NPCTest1::NPCTest1()
     31  : NPC(NULL)
    3132{
    3233  this->setClassID(CL_NPC_TEST1, "NPCTest1");
Note: See TracChangeset for help on using the changeset viewer.