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 | * Fabian 'x3n' Landau |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | #include "test1.h" |
---|
30 | #include "test2.h" |
---|
31 | #include "test3.h" |
---|
32 | #include "core/CoreIncludes.h" |
---|
33 | #include "core/Executor.h" |
---|
34 | |
---|
35 | namespace orxonox |
---|
36 | { |
---|
37 | CreateFactory(Test2); |
---|
38 | |
---|
39 | Test2::Test2() |
---|
40 | { |
---|
41 | RegisterObject(Test2); |
---|
42 | |
---|
43 | this->usefullClass1_ = Class(Test1); |
---|
44 | this->usefullClass2_ = Class(Test2); |
---|
45 | this->usefullClass3_ = Class(Test3); |
---|
46 | |
---|
47 | timer1.setTimer(1, true, this, createExecutor(createFunctor(&Test2::timerFunction1))); |
---|
48 | timer2.setTimer(5, true, this, createExecutor(createFunctor(&Test2::timerFunction2))); |
---|
49 | timer3.setTimer(10, false, this, createExecutor(createFunctor(&Test2::timerFunction3))); |
---|
50 | } |
---|
51 | |
---|
52 | Test2::~Test2() |
---|
53 | { |
---|
54 | } |
---|
55 | |
---|
56 | void Test2::timerFunction1() |
---|
57 | { |
---|
58 | std::cout << "Test2: 1 Sekunde" << std::endl; |
---|
59 | } |
---|
60 | |
---|
61 | void Test2::timerFunction2() |
---|
62 | { |
---|
63 | std::cout << "Test2: 5 Sekunden" << std::endl; |
---|
64 | } |
---|
65 | |
---|
66 | void Test2::timerFunction3() |
---|
67 | { |
---|
68 | std::cout << "Test2: 10 Sekunden sind um!" << std::endl; |
---|
69 | } |
---|
70 | |
---|
71 | bool Test2::usefullClass1isA(Identifier* identifier) |
---|
72 | { |
---|
73 | return this->usefullClass1_->isA(identifier); |
---|
74 | } |
---|
75 | |
---|
76 | bool Test2::usefullClass2isA(Identifier* identifier) |
---|
77 | { |
---|
78 | return this->usefullClass2_->isA(identifier); |
---|
79 | } |
---|
80 | |
---|
81 | bool Test2::usefullClass3isA(Identifier* identifier) |
---|
82 | { |
---|
83 | return this->usefullClass3_.isA(identifier); |
---|
84 | } |
---|
85 | |
---|
86 | void Test2::setUsefullClass1(Identifier* identifier) |
---|
87 | { |
---|
88 | std::cout << std::endl; |
---|
89 | std::cout << "Test2: usefullClass1->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << std::endl; |
---|
90 | std::cout << "Test2: usefullClass1->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << std::endl; |
---|
91 | std::cout << "Test2: usefullClass1->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << std::endl; |
---|
92 | this->usefullClass1_ = identifier; |
---|
93 | } |
---|
94 | |
---|
95 | void Test2::setUsefullClass2(Identifier* identifier) |
---|
96 | { |
---|
97 | std::cout << std::endl; |
---|
98 | std::cout << "Test2: usefullClass2->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << std::endl; |
---|
99 | std::cout << "Test2: usefullClass2->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << std::endl; |
---|
100 | std::cout << "Test2: usefullClass2->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << std::endl; |
---|
101 | this->usefullClass2_ = identifier; |
---|
102 | } |
---|
103 | |
---|
104 | void Test2::setUsefullClassOfTypeTest3(Identifier* identifier) |
---|
105 | { |
---|
106 | std::cout << std::endl; |
---|
107 | std::cout << "Test2: usefullClass3->isA(Class(Test1)): " << identifier->isA(Class(Test1)) << std::endl; |
---|
108 | std::cout << "Test2: usefullClass3->isA(Class(Test2)): " << identifier->isA(Class(Test2)) << std::endl; |
---|
109 | std::cout << "Test2: usefullClass3->isA(Class(Test3)): " << identifier->isA(Class(Test3)) << std::endl; |
---|
110 | this->usefullClass3_ = identifier; |
---|
111 | } |
---|
112 | } |
---|