Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/cleanup/src/world_entities/npcs/npc_test.cc @ 10764

Last change on this file since 10764 was 10376, checked in by patrick, 18 years ago

merged branche ai to trunk

File size: 2.8 KB
Line 
1
2
3/*
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.
12
13   ### File Specific:
14   main-programmer: Patrick Boenzli
15   co-programmer:
16*/
17#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
18
19
20#include "npc_test.h"
21#include <stdio.h>
22
23#include "state.h"
24#include "debug.h"
25
26#include "loading/factory.h"
27#include "loading/load_param.h"
28
29#include "md2/md2Model.h"
30#include "player.h"
31#include "playable.h"
32
33#include "weapons/test_gun.h"
34#include "weapons/turret.h"
35#include "weapons/cannon.h"
36
37
38ObjectListDefinition(NPC2);
39CREATE_FACTORY(NPC2);
40
41
42NPC2::NPC2(const TiXmlElement* root)
43{
44  this->registerObject(this, NPC2::_objectList);
45
46  if (root != NULL)
47    this->loadParams(root);
48
49
50  // create the weapons and their manager
51
52
53  this->getWeaponManager().changeWeaponConfig(1);
54  Weapon* wpRight = new TestGun(0);
55  wpRight->setName("testGun Right");
56  Weapon* wpLeft = new TestGun(1);
57  wpLeft->setName("testGun Left");
58
59  this->addWeapon(wpLeft, 1, 0);
60  this->addWeapon(wpRight,1 ,1);
61
62  this->setHealthMax(100);
63  this->setHealth(80);
64
65  this->getWeaponManager().setSlotCount(7);
66
67  this->getWeaponManager().setSlotPosition(0, Vector(-2.6, .1, -3.0));
68  this->getWeaponManager().setSlotCapability(0, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
69
70  this->getWeaponManager().setSlotPosition(1, Vector(-2.6, .1, 3.0));
71  this->getWeaponManager().setSlotCapability(1, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
72
73  this->getWeaponManager().setSlotPosition(2, Vector(-1.5, .5, -.5));
74  this->getWeaponManager().setSlotDirection(2, Quaternion(-M_PI_4*.5, Vector(1,0,0)));
75
76  this->getWeaponManager().setSlotPosition(3, Vector(-1.5, .5, .5));
77  this->getWeaponManager().setSlotDirection(3, Quaternion(M_PI_4*.5, Vector(1,0,0)));
78
79  this->getWeaponManager().setSlotPosition(4, Vector(-1.5, -.5, .5));
80  this->getWeaponManager().setSlotDirection(4, Quaternion(-M_PI_4*.5+M_PI, Vector(1,0,0)));
81
82  this->getWeaponManager().setSlotPosition(5, Vector(-1.5, -.5, -.5));
83  this->getWeaponManager().setSlotDirection(5, Quaternion(+M_PI_4*.5-M_PI, Vector(1,0,0)));
84
85  this->getWeaponManager().setSlotPosition(6, Vector(-1, 0.0, 0));
86  this->getWeaponManager().setSlotCapability(6, WTYPE_ALLDIRS | WTYPE_DIRECTIONAL);
87
88  this->getWeaponManager().getFixedTarget()->setParent(this);
89  this->getWeaponManager().getFixedTarget()->setRelCoor(100000,0,0);
90
91}
92
93NPC2::~NPC2()
94{
95}
96
97void NPC2::loadParams(const TiXmlElement* root)
98{
99  NPC::loadParams(root);
100
101}
102
103
104
105void NPC2::tick(float dt)
106{
107
108
109
110
111  // animating the md2 model
112  if( likely(this->getModel(0) != NULL) && this->getModel(0)->isA(MD2Model::staticClassID()))
113    ((MD2Model*)this->getModel(0))->tick(dt);
114}
115
116
117
Note: See TracBrowser for help on using the repository browser.