Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/trunk/src/world_entities/npcs/npc.cc @ 7578

Last change on this file since 7578 was 7076, checked in by bensch, 19 years ago

weaponAdjustment

File size: 2.0 KB
RevLine 
[1853]1
2
[4597]3/*
[1853]4   orxonox - the future of 3D-vertical-scrollers
5
6   Copyright (C) 2004 orx
7
8   This program is free software; you can redistribute it and/or modify
9   it under the terms of the GNU General Public License as published by
10   the Free Software Foundation; either version 2, or (at your option)
11   any later version.
[1855]12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer:
[1853]16*/
[5357]17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
[1853]18
19
20#include "npc.h"
[5033]21#include "obb_tree.h"
[1853]22
[4984]23#include "state.h"
[5427]24#include "stdlibincl.h"
[5451]25#include "power_ups/turret_power_up.h"
[5458]26#include "power_ups/laser_power_up.h"
[4984]27
[1858]28using namespace std;
[1853]29
[1858]30
[4976]31NPC::NPC()
[1931]32{
[4597]33  this->setClassID(CL_NPC, "NPC");
[6142]34  this->toList(OM_GROUP_00);
[1931]35}
[1853]36
[5034]37
[1853]38NPC::~NPC () {}
39
40
[5029]41void NPC::collidesWith(WorldEntity* entity, const Vector& location)
42{
[7076]43
44  if (entity == collider)
45    return;
46  collider = entity;
47
48  if (entity->isA(CL_PROJECTILE))
[5258]49  {
[7076]50    this->decreaseHealth(entity->getHealth() *(float)rand()/(float)RAND_MAX);
51    // EXTREME HACK
52    if (this->getHealth() <= 0.0f)
[5451]53    {
[7076]54      this->destroy();
[5451]55    }
[7076]56  }
[5451]57
[7076]58
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//   }
[1931]86}
Note: See TracBrowser for help on using the repository browser.