Colobot
taskshield.h
1 /*
2  * This file is part of the Colobot: Gold Edition source code
3  * Copyright (C) 2001-2014, Daniel Roux, EPSITEC SA & TerranovaTeam
4  * http://epsiteс.ch; http://colobot.info; http://github.com/colobot
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 3 of the License, or
9  * (at your option) any later version.
10  *
11  * This program is distributed in the hope that it will be useful,
12  * but WITHOUT ANY WARRANTY; without even the implied warranty of
13  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
14  * See the GNU General Public License for more details.
15  *
16  * You should have received a copy of the GNU General Public License
17  * along with this program. If not, see http://gnu.org/licenses
18  */
19 
20 // taskshield.h
21 
22 #pragma once
23 
24 
25 #include "object/task/task.h"
26 
27 #include "math/vector.h"
28 
29 
30 const float RADIUS_SHIELD_MIN = 40.0f; // minimum radius of the protected zone
31 const float RADIUS_SHIELD_MAX = 100.0f; // maximum radius of the protected zone
32 
33 
34 enum TaskShieldPhase
35 {
36  TS_UP1 = 1, // up
37  TS_UP2 = 2, // up
38  TS_SHIELD = 3, // shield deployed
39  TS_SMOKE = 4, // smoke
40  TS_DOWN1 = 5, // down
41  TS_DOWN2 = 6, // down
42 };
43 
44 enum TaskShieldMode
45 {
46  TSM_UP = 1, // deploys shield
47  TSM_DOWN = 2, // returns the shield
48  TSM_UPDATE = 3, // radius change
49  TSM_START = 4, // start with shield up
50 };
51 
52 
53 
54 class CTaskShield : public CTask
55 {
56 public:
57  CTaskShield(CObject* object);
58  ~CTaskShield();
59 
60  bool EventProcess(const Event &event);
61 
62  Error Start(TaskShieldMode mode, float delay);
63  Error IsEnded();
64  bool IsBusy();
65  bool Abort();
66 
67 protected:
68  Error Stop();
69  bool CreateLight(Math::Vector pos);
70  void IncreaseShield();
71  float GetRadius();
72 
73 protected:
74  TaskShieldPhase m_phase;
75  float m_progress;
76  float m_speed;
77  float m_time;
78  float m_delay;
79  float m_lastParticle;
80  float m_lastRay;
81  float m_lastIncrease;
82  float m_energyUsed;
83  bool m_bError;
84  Math::Vector m_shieldPos;
85  int m_rankSphere;
86  int m_soundChannel;
87  int m_effectLight;
88 };
89 
Definition: taskshield.h:54
Vector struct and related functions.
Definition: task.h:64
Error
Type of error or info message.
Definition: global.h:32
3D (3x1) vector
Definition: vector.h:52
Event sent by system, interface or game.
Definition: event.h:678
Definition: object.h:357