Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: orxonox.OLD/branches/playability/src/world_entities/projectiles/acid_splash.cc @ 10324

Last change on this file since 10324 was 10298, checked in by nicolasc, 19 years ago

Fixed Wooblegrid, transparancy problem (acid splashes) still exists

File size: 3.0 KB
Line 
1/*
2   orxonox - the future of 3D-vertical-scrollers
3
4   Copyright (C) 2004-2006 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: Marc Schaerrer
13   co-programmer: Benjamin Grauer
14
15*/
16
17
18#define DEBUG_SPECIAL_MODULE DEBUG_MODULE_WEAPON
19
20#include "acid_splash.h"
21
22#include "state.h"
23
24//#include "space_ships/space_ship.h"
25
26#include <cassert>
27#include "debug.h"
28
29//#include "static_model.h"
30
31#include "effects/wobblegrid.h"
32
33
34#include "class_id_DEPRECATED.h"
35ObjectListDefinition(AcidSplash);
36CREATE_FAST_FACTORY_STATIC(AcidSplash);
37
38/**
39 *  standard constructor
40*/
41AcidSplash::AcidSplash () : Projectile()
42{
43  this->registerObject(this, AcidSplash::_objectList);
44
45  srand(time(0));   //initialize Random Nomber Generator
46
47  //this->loadModel("models/projectiles/laser.obj");
48
49  this->setMinEnergy(1);
50  this->setHealthMax(0);
51  this->lifeSpan = 3.0;
52  this->angle     = 0;
53
54  this->grid = new Wobblegrid( 5);
55  this->grid->setParent( this);
56
57//  if (rand()/2 == 0) //!<Randomized Textrures
58    this->grid->setTexture( "maps/acid3.png");
59//   else
60//     this->grid->setTexture( "maps/blub.png");
61
62  this->grid->toList(this->getOMListNumber());
63  this->toList(OM_ENVIRON);
64}
65
66
67/**
68 *  standard deconstructor
69 *
70 */
71AcidSplash::~AcidSplash ()
72{
73  // delete this->emitter;
74  //delete this->grid;
75 
76}
77
78
79void AcidSplash::activate()
80{
81  this->unhide();
82  this->grid->setVisibiliy(true);
83
84  this->setPhysDamage(10);
85  this->setElecDamage(0);
86  this->setHealth(0);
87}
88
89
90void AcidSplash::deactivate()
91{
92  this->lifeCycle = 0.0;
93
94  this->hide();
95  this->grid->setVisibiliy(false);
96  this->toList(OM_DEAD);
97  this->removeNode();
98 
99  AcidSplash::fastFactory->kill(this);
100}
101
102
103void AcidSplash::collidesWith(WorldEntity* entity, const Vector& location)
104{
105
106  if (this->hitEntity != entity)
107    this->destroy( entity );
108  this->hitEntity = entity;
109  //dynamic_cast<SpaceShip*>(entity)->damage(this->getPhysDamage(),this->getElecDamage());
110  //this->destroy(this);
111  this->deactivate();
112 
113  return;
114
115  //dynamic_cast<SpaceShip*>(entity)->damage( this->getPhysDamage(), this->getElecDamage());
116  //entity->destroy(this);
117  //this->deactivate();
118}
119
120/**
121 *  signal tick, time dependent things will be handled here
122 * @param dt time since last tick
123*/
124void AcidSplash::tick (float dt)
125{
126  //Vector v = *this->flightDirection * ( this->speed * time * 1000 + 0.1);
127  Vector v = this->velocity * dt;
128  this->shiftCoor(v);
129
130  if (this->tickLifeCycle(dt))
131    this->deactivate();
132
133  this->angle += this->rotationSpeed * dt;
134
135  this->grid->tick(dt);
136
137}
138
139/**
140 *  the function gets called, when the projectile is destroyed
141*/
142void AcidSplash::destroy (WorldEntity* killer)
143{
144  this->deactivate();
145  Projectile::destroy( killer );
146  PRINTF(5)("DESTROY AcidSplash\n");
147  this->lifeCycle = .95; //!< @todo calculate this usefully.
148}
149
150
151void AcidSplash::draw () const
152{
153  this->grid->draw();
154}
Note: See TracBrowser for help on using the repository browser.