Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/adm/src/world_entities/npcs/adm_turret.cc @ 10664

Last change on this file since 10664 was 10664, checked in by retolu, 17 years ago

compiles

File size: 3.1 KB
Line 
1/*
2* orxonox - the future of 3D-vertical-scrollers
3*
4* Copyright (C) 2004 orx
5*
6* This program is free software; you can redistribute it and/or modify
7* it under the terms of the GNU General Public License as published by
8* the Free Software Foundation; either version 2, or (at your option)
9* any later version.
10*
11*     ### File Specific:
12*     main-programmer: Reto Luechinger
13*/
14
15
16#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WORLD_ENTITY
17#include "adm_turret.h"
18#include "weapons/weapon_manager.h"
19#include "weapons/weapon.h"
20#include "lib/util/loading/factory.h"
21#include "world_entities/projectiles/projectile.h"
22#include "loading/load_param.h"
23#include "debug.h"
24
25ObjectListDefinition(AdmTurret);
26CREATE_FACTORY(AdmTurret);
27
28
29/**
30*  Standard constructor
31*/
32AdmTurret::AdmTurret ()
33{
34        this->init();
35}
36
37/**
38*  destructs the turret, deletes allocated memory
39*/
40AdmTurret::~AdmTurret ()
41{
42          // will be deleted
43}
44
45AdmTurret::AdmTurret (const  TiXmlElement* root)
46{
47        this->init();
48        if (root != NULL)
49        {
50                this->loadParams(root);
51        }
52}
53
54void AdmTurret::init()
55{
56        this->registerObject(this, AdmTurret::_objectList);
57
58        // load the 3 parts of the turret
59        // this-> loadModel ("...", , )
60        // this-> loadModel ("...", , )
61        // this-> loadModel ("...", , )
62
63        //Cannon Node: 2 Cannons fixed left and right of the main turret
64        this->cannonNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
65        this->cannonNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
66        this->cannonNode.setParent(this);
67        // this->cannonNode.setRelCoor( , , )
68
69        //Sensor Node: Sensor rotating independently from main turret (like Radar)
70        this->sensorNode.addNodeFlags(PNODE_PROHIBIT_DELETE_WITH_PARENT);
71        this->sensorNode.addNodeFlags(PNODE_PROHIBIT_CHILD_DELETE);
72        this->sensorNode.setParent(this);
73        // this->sensorNode.setRelCoor( , , )
74
75        // initialise Weapons here
76}
77
78void AdmTurret::loadParams(const TiXmlElement* root)
79{
80        WorldEntity::loadParams(root);
81
82        LoadParam(root, "target", this, AdmTurret, setTarget)
83                .describe("the filename of the World Entity, that is to be shot at")
84                .defaultValues("");
85}
86
87void AdmTurret::tick(float dt)
88{
89}
90
91void AdmTurret::draw() const
92{
93}
94
95void AdmTurret::collidesWith(WorldEntity* entity, const Vector& location)
96{
97}
98
99void AdmTurret::activate()
100{
101}
102
103void AdmTurret::deactivate()
104{
105}
106
107void AdmTurret::setTarget(const std::string& target)
108{
109        WorldEntity* targetEntity = WorldEntity::objectList().getObject(target);
110        if (targetEntity != NULL) 
111        {
112                this->myTarget = targetEntity;
113        }
114        else
115        {
116                PRINTF(2)("ERROR ADMTURRET : Target %s does not exist\n", target.c_str());
117        }
118}
119
120bool AdmTurret::isVisible(const WorldEntity myTarget)
121{
122return true;
123}
124
125float AdmTurret::aim(const WorldEntity Target)
126{
127return 0;
128}
129
130void AdmTurret::fire()
131{
132        // Projectile* pj =  this->getProjectile();
133        // if (pj == NULL) return;
134
135        //pj->setOwner(this->getOwner());
136        //pj->setParent(PNode::getNullParent());
137        //pj->setVelocity(this->getAbsDir().apply(Vector( , , )) );
138        //pj->setAbsCoor(this->getEmissionPoint());
139        //pj->setAbsDir(this->getAbsDir());
140        //pj->activate();
141}
Note: See TracBrowser for help on using the repository browser.