| [1383] | 1 | /* |
|---|
| 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
|---|
| 3 | * > www.orxonox.net < |
|---|
| 4 | * |
|---|
| 5 | * |
|---|
| 6 | * License notice: |
|---|
| 7 | * |
|---|
| 8 | * This program is free software; you can redistribute it and/or |
|---|
| 9 | * modify it under the terms of the GNU General Public License |
|---|
| 10 | * as published by the Free Software Foundation; either version 2 |
|---|
| 11 | * of the License, or (at your option) any later version. |
|---|
| 12 | * |
|---|
| 13 | * This program is distributed in the hope that it will be useful, |
|---|
| 14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
|---|
| 15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|---|
| 16 | * GNU General Public License for more details. |
|---|
| 17 | * |
|---|
| 18 | * You should have received a copy of the GNU General Public License |
|---|
| 19 | * along with this program; if not, write to the Free Software |
|---|
| 20 | * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. |
|---|
| 21 | * |
|---|
| 22 | * Author: |
|---|
| 23 | * Benjamin Knecht |
|---|
| 24 | * Co-authors: |
|---|
| 25 | * ... |
|---|
| 26 | * |
|---|
| 27 | */ |
|---|
| 28 | |
|---|
| [7601] | 29 | /** |
|---|
| 30 | @file Trigger.h |
|---|
| 31 | @brief Definition of the Trigger class. |
|---|
| 32 | @ingroup NormalTrigger |
|---|
| 33 | */ |
|---|
| 34 | |
|---|
| [1383] | 35 | #ifndef _Trigger_H__ |
|---|
| 36 | #define _Trigger_H__ |
|---|
| 37 | |
|---|
| [5730] | 38 | #include "objects/ObjectsPrereqs.h" |
|---|
| [3196] | 39 | |
|---|
| [1541] | 40 | #include <set> |
|---|
| [1693] | 41 | #include <queue> |
|---|
| [1383] | 42 | |
|---|
| [3196] | 43 | #include "tools/BillboardSet.h" |
|---|
| [1693] | 44 | |
|---|
| [7601] | 45 | #include "TriggerBase.h" |
|---|
| 46 | |
|---|
| [2029] | 47 | namespace orxonox |
|---|
| 48 | { |
|---|
| [1383] | 49 | |
|---|
| [7601] | 50 | /** |
|---|
| 51 | @brief |
|---|
| 52 | |
|---|
| 53 | @author |
|---|
| 54 | Benjamin Knecht |
|---|
| 55 | |
|---|
| 56 | @ingroup NormalTrigger |
|---|
| 57 | */ |
|---|
| 58 | class _ObjectsExport Trigger : public TriggerBase |
|---|
| [1383] | 59 | { |
|---|
| 60 | public: |
|---|
| [2019] | 61 | Trigger(BaseObject* creator); |
|---|
| [2071] | 62 | virtual ~Trigger(); |
|---|
| [1383] | 63 | |
|---|
| [1969] | 64 | virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); |
|---|
| 65 | virtual void tick(float dt); |
|---|
| 66 | |
|---|
| [7601] | 67 | inline bool isActive(void) const |
|---|
| 68 | { return this->bActive_; } |
|---|
| [1969] | 69 | |
|---|
| [3033] | 70 | inline void setVisible(bool visibility) |
|---|
| 71 | { this->debugBillboard_.setVisible(visibility); } |
|---|
| 72 | |
|---|
| [7601] | 73 | void delayChanged(void); |
|---|
| [2029] | 74 | |
|---|
| [1693] | 75 | bool switchState(); |
|---|
| [1383] | 76 | |
|---|
| [1969] | 77 | static void debugFlares(bool bVisible); |
|---|
| 78 | virtual void changedVisibility(); |
|---|
| 79 | |
|---|
| [2029] | 80 | protected: |
|---|
| 81 | inline bool isTriggered() { return this->isTriggered(this->mode_); } |
|---|
| [3280] | 82 | virtual bool isTriggered(TriggerMode::Value mode); |
|---|
| [3033] | 83 | virtual void triggered(bool bIsTriggered); |
|---|
| [2029] | 84 | |
|---|
| [1383] | 85 | private: |
|---|
| [1541] | 86 | bool checkAnd(); |
|---|
| 87 | bool checkOr(); |
|---|
| [1671] | 88 | bool checkXor(); |
|---|
| [2029] | 89 | void setBillboardColour(const ColourValue& colour); |
|---|
| [1851] | 90 | void storeState(); |
|---|
| [1541] | 91 | |
|---|
| [2029] | 92 | bool bActive_; |
|---|
| 93 | bool bTriggered_; |
|---|
| [1851] | 94 | |
|---|
| [1693] | 95 | char latestState_; |
|---|
| [2029] | 96 | float remainingTime_; |
|---|
| 97 | float timeSinceLastEvent_; |
|---|
| 98 | |
|---|
| 99 | // bool bUpdating_; |
|---|
| 100 | BillboardSet debugBillboard_; |
|---|
| 101 | |
|---|
| 102 | std::queue<std::pair<float, char> > stateChanges_; |
|---|
| [1383] | 103 | }; |
|---|
| 104 | |
|---|
| 105 | } |
|---|
| 106 | |
|---|
| 107 | #endif /* _Trigger_H__ */ |
|---|