00001 /* 00002 SagaEngine library 00003 Copyright (c) 2002-2006 Skalden Studio AS 00004 00005 This software is provided 'as-is', without any express or implied 00006 warranty. In no event will the authors be held liable for any 00007 damages arising from the use of this software. 00008 00009 Permission is granted to distribute the library under the terms of the 00010 Q Public License version 1.0. Be sure to read and understand the license 00011 before using the library. It should be included here, or you may read it 00012 at http://www.trolltech.com/products/qt/licenses/licensing/qpl 00013 00014 The original version of this library can be located at: 00015 http://www.sagaengine.com/ 00016 00017 Rune Myrland 00018 rune@skalden.com 00019 */ 00020 00021 00022 #ifndef SpawnComponent_hpp 00023 #define SpawnComponent_hpp 00024 00025 #include "comp/Component.hpp" 00026 #include "comp/Composite.hpp" 00027 #include "../sim.hpp" 00028 #include "../pos/PosComponent.hpp" 00029 #include "util/type/all.hpp" 00030 #include "util/vecmath/util_vecmath.hpp" 00031 00032 namespace se_core { 00033 class _SeCoreExport SpawnComponent : public Component { 00034 public: 00035 typedef ComponentPtr<SpawnComponent, sct_SPAWN> Ptr; 00036 00037 SpawnComponent(Composite* owner, PosComponent* pos); 00038 SpawnComponent(Composite* owner, const ComponentFactory* factory); 00039 virtual ~SpawnComponent(); 00040 00041 static SpawnComponent* get(Composite& composite) { 00042 SpawnComponent* c = static_cast<SpawnComponent*>(composite.component(se_core::sct_SPAWN)); 00043 return c; 00044 } 00045 00046 static const SpawnComponent* get(const Composite& composite) { 00047 const SpawnComponent* c = static_cast<const SpawnComponent*>(composite.component(se_core::sct_SPAWN)); 00048 return c; 00049 } 00050 00051 static SpawnComponent* get(Component& component) { 00052 SpawnComponent* c = static_cast<SpawnComponent*>(component.owner()->component(se_core::sct_SPAWN)); 00053 return c; 00054 } 00055 00056 static const SpawnComponent* get(const Component& component) { 00057 const SpawnComponent* c = static_cast<const SpawnComponent*>(component.owner()->component(se_core::sct_SPAWN)); 00058 return c; 00059 } 00060 00061 00062 void cleanup(); 00063 00070 Composite* spawner() const; 00071 00072 Composite* spawn(const char* name, int spawnPointId, long deniedTsMask = 0); 00073 void incSpawnCount() { ++spawnCount_; } 00074 void decSpawnCount() { --spawnCount_; } 00075 int spawnCount() const { return spawnCount_; } 00076 00082 void setSpawnPoints(int count, const ViewPoint* const* spawnPoints); 00083 00088 const ViewPoint* spawnPoint(short id) const; 00089 bool hasSpawnPoint(short id) const; 00090 int spawnPointCount() const { 00091 return spawnPointCount_; 00092 } 00093 00094 void setSpawner(Composite* spawner); 00095 void resetSpawner(); 00096 00097 virtual void setDead(); 00098 00099 protected: 00100 PosComponent* pos_; 00101 00113 Composite::RefPtr spawner_; 00114 00115 int spawnCount_; 00116 00117 00119 int spawnPointCount_; 00120 00122 const ViewPoint* const* spawnPoints_; 00123 }; 00124 00125 } 00126 00127 #endif
Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:12 2007 by Doxygen version 1.3.9.1.