1 //==============================================================================
2 // This program is free software; you can redistribute it and/or modify
3 // it under the terms of the GNU General Public License as published by
4 // the Free Software Foundation; either version 2 of the License, or
5 // (at your option) any later version.
6 //
7 // This program is distributed in the hope that it will be useful,
8 // but WITHOUT ANY WARRANTY; without even the implied warranty of
9 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 // GNU Library General Public License for more details.
11 //
12 // You should have received a copy of the GNU General Public License
13 // along with this program; if not, write to the Free Software
14 // Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
15 //==============================================================================
16
17 //==============================================================================
18 // File: cBurnable.cpp
19 // Project: Shooting Star
20 // Author:
21 // Copyrights (c) 2003 2ndPoint ry (www.2ndpoint.fi)
22 //------------------------------------------------------------------------------
23 // Revision history
24 //==============================================================================
25
26 //==============================================================================
27 // Includes
28 #include "cBurnable.hpp"
29 #include "cWorld.hpp"
30 //------------------------------------------------------------------------------
31 // Namespaces
32 using namespace ShootingStar;
33 //==============================================================================
34
35
36 //! Constructor
cBurnable(void)37 cBurnable::cBurnable (void)
38 {
39 // Empty
40 };
41
42 //! Destructor
~cBurnable(void)43 cBurnable::~cBurnable (void)
44 {
45 // Empty
46 };
47
48 void
Update(Uint32 deltaTime)49 cBurnable::Update (Uint32 deltaTime)
50 {
51 if ( mEffect.IsValid () )
52 {
53 if ( !mEffect->IsAlive () )
54 mEffect = NULL;
55 }
56 }
57
58 void
Burn(Uint32 time,ObjectID burner)59 cBurnable::Burn (Uint32 time, ObjectID burner)
60 {
61 // Spawn new effect
62 if ( !mEffect.IsValid () )
63 {
64 mEffect = new cBurningEffect (this);
65 cWorld::GetInstance ().SpawnObject (mEffect);
66 }
67 mEffect->AddTime (time);
68
69 // TEMP (causes enemies to attack)
70 DoDamage (0, cVector2f (0.0f, 0.0f), burner);
71 }
72
73 //==============================================================================
74 // EOF
75 //==============================================================================
76