Skyscraper 2.0
trigger.h
Go to the documentation of this file.
1/*
2 Scalable Building Simulator - Proximity Trigger Object
3 The Skyscraper Project - Version 2.0
4 Copyright (C)2004-2024 Ryan Thoryk
5 https://www.skyscrapersim.net
6 https://sourceforge.net/projects/skyscraper/
7 Contact - ryan@skyscrapersim.net
8
9 This program is free software; you can redistribute it and/or
10 modify it under the terms of the GNU General Public License
11 as published by the Free Software Foundation; either version 2
12 of the License, or (at your option) any later version.
13
14 This program is distributed in the hope that it will be useful,
15 but WITHOUT ANY WARRANTY; without even the implied warranty of
16 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 GNU General Public License for more details.
18
19 You should have received a copy of the GNU General Public License
20 along with this program; if not, write to the Free Software
21 Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
22*/
23
24#ifndef _SBS_TRIGGER_H
25#define _SBS_TRIGGER_H
26
27namespace SBS {
28
29class SBSIMPEXP Trigger : public Object
30{
31public:
32
33 //functions
34 Trigger(Object *parent, const std::string &name, bool permanent, const std::string &sound_file, Vector3 area_min, Vector3 area_max, const std::vector<std::string> &action_names);
35 ~Trigger();
36 void Enabled(bool value);
37 bool SetSelectPosition(int position);
38 bool ChangeSelectPosition(int position);
39 bool NextSelectPosition(bool check_state = true);
40 bool PreviousSelectPosition(bool check_state = true);
41 int GetSelectPosition();
42 std::string GetPositionAction(int position);
43 std::string GetSelectPositionAction();
44 int GetNextSelectPosition();
45 int GetPreviousSelectPosition();
46 int GetPositions();
47 void PlaySound();
48 int FindActionPosition(const std::string &name);
49 bool DoAction();
50 void Loop();
51 bool IsInside();
52 bool IsInside(const Vector3 &position);
53 bool IsEnabled() { return is_enabled; }
54 Ogre::AxisAlignedBox GetBounds(bool relative = false);
55 Vector3 GetMin();
56 Vector3 GetMax();
57 bool IsOutside(Vector3 v1, Vector3 v2);
58 virtual void OnEntry() {}
59 virtual void OnExit() {}
60
61private:
62 Ogre::AxisAlignedBox *area_box;
63 int current_position; //current trigger position
66 std::vector<std::string> Actions; //trigger actions
67
68 Sound *sound; //sound object
69};
70
71}
72
73#endif
bool IsEnabled()
Definition trigger.h:53
bool is_enabled
Definition trigger.h:65
Sound * sound
Definition trigger.h:68
virtual void OnExit()
Definition trigger.h:59
bool is_inside
Definition trigger.h:64
std::vector< std::string > Actions
Definition trigger.h:66
int current_position
Definition trigger.h:63
Ogre::AxisAlignedBox * area_box
Definition trigger.h:62
virtual void OnEntry()
Definition trigger.h:58
Ogre::Vector3 Vector3
Definition globals.h:58
#define SBSIMPEXP
Definition globals.h:53