Actor.hpp

Go to the documentation of this file.
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 engine_thing_Actor_hpp
00023 #define engine_thing_Actor_hpp
00024 
00025 #include "comp/Composite.hpp"
00026 #include "../action/sim_action.hpp"
00027 #include "../physics/Move.hpp"
00028 #include "../physics/Physics.hpp"
00029 #include "../action/Action.hpp"
00030 #include "../action/ActionAndParameter.hpp"
00031 #include "../react/sim_react.hpp"
00032 #include "../react/ThingCollide.hpp"
00033 #include "../stat/sim_stat.hpp"
00034 #include "../pos/Anim.hpp"
00035 #include "../pos/Pos.hpp"
00036 #include "../pos/PosComponent.hpp"
00037 #include "util/vecmath/Point3.hpp"
00038 #include "util/type/String.hpp"
00039 #include "../script/ScriptComponent.hpp"
00040 #include "../spawn/SpawnComponent.hpp"
00041 #include "../action/ActionComponent.hpp"
00042 #include "../action/ActionAndParameter.hpp"
00043 #include "../physics/PhysicsComponent.hpp"
00044 #include "../react/CollisionComponent.hpp"
00045 #include "../custom/StatComponent.hpp"
00046 
00047 
00048 namespace se_core {
00049 
00053     class _SeCoreExport Actor : public Component {
00054     public:
00055         typedef ComponentPtr<Actor, sct_BLOB> Ptr;
00056 
00059         Actor(Composite* owner, const ComponentFactory* factory);
00060         ~Actor();
00061 
00062 
00063         void stopScript() {
00064             scriptComponent_->stopScript();
00065         }
00066 
00067         void popScript() {
00068             scriptComponent_->popScript();
00069         }
00070 
00071         void pushScript(const Script* s) {
00072             scriptComponent_->pushScript(s);
00073         }
00074 
00075         void setDefaultScript(const Script* s) {
00076             scriptComponent_->setDefaultScript(s);
00077         }
00078 
00079 
00080         bool hasActiveScript() { 
00081             return scriptComponent_->hasActiveScript();
00082         }
00083         const Script* script() { 
00084             return scriptComponent_->script();
00085         }
00086 
00087         void disrupt() {
00088             actionComponent_->disrupt();
00089         }
00090 
00091         void affect() {
00092             if(!isDead())
00093                 physicsComponent_->affect();
00094         }
00095 
00096         bool calcNextCoor() {
00097             return physicsComponent_->calcNextCoor();
00098         }
00099 
00100         bool isMover() const {
00101             return physicsComponent_->isMover();
00102         }
00103 
00104         Move& nextMove() {
00105             return physicsComponent_->nextMove();
00106         }
00107 
00108         const Move& move() const {
00109             return physicsComponent_->move();
00110         }
00111 
00112         void setDefaultPhysics(const Physics* ph) {
00113             physicsComponent_->setDefaultPhysics(ph);
00114         }
00115 
00116         void pushPhysics(const Physics* ph) {
00117             physicsComponent_->pushPhysics(ph);
00118         }
00119 
00120         void pushPhysics(const char* ph) {
00121             physicsComponent_->pushPhysics(ph);
00122         }
00123 
00124         void popPhysics() {
00125             physicsComponent_->popPhysics();
00126         }
00127 
00128         void scheduleForDestruction() {
00129             owner()->scheduleForDestruction();
00130         }
00131 
00132         coor_t walkSpeed() const {
00133             return statComponent_->walkSpeed();
00134         }
00135 
00136         Abilities* abilities() {
00137             return statComponent_->abilities(); 
00138         }
00139 
00147         void say(const char* message);
00148         void sound(const char* snd);
00149 
00150 
00151         const Composite* target() const { return statComponent_->target(); }
00152         Composite* target() { return statComponent_->target(); }
00153         bool hasTarget() const { return statComponent_->hasTarget(); }
00154         void setTarget(Composite* target) { statComponent_->setTarget(target); }
00155         void resetTarget() { statComponent_->resetTarget(); }
00156 
00157         const Pos& pos() const { return posComponent_->pos(); }
00158         Pos& nextPos() const { return posComponent_->nextPos(); }
00159 
00160         bool hasDefaultAction() const {
00161             return statComponent_->hasDefaultAction();
00162         }
00163 
00164         const Action* defaultAction(Parameter& out) const { 
00165             return statComponent_->defaultAction(out);
00166         }
00167 
00171         void planDefaultAction() const;
00172 
00173 
00174     protected:
00175         PosComponent* posComponent_;
00176         SpawnComponent* spawnComponent_;
00177         ScriptComponent* scriptComponent_;
00178         ActionComponent* actionComponent_;
00179         PhysicsComponent* physicsComponent_;
00180         StatComponent* statComponent_;
00181     };
00182 
00183 }
00184 
00185 #endif

Home Page | SagaEngine trunk (updated nightly) reference generated Sun Dec 2 20:06:12 2007 by Doxygen version 1.3.9.1.

SourceForge.net Logo