00001 #ifndef GAMEOBJECT_H_INCLUDED
00002 #define GAMEOBJECT_H_INCLUDED
00003
00004 #include <list>
00005 #include "Object.h"
00006 #include <iostream>
00007 #include <map>
00008 #include <vector>
00009
00010 using namespace std;
00011
00012 class Behaviour;
00013 class Transform;
00014 class Component;
00015 class Collider;
00016 class Animation;
00017 class ParticleSystem;
00018 class MeshRenderer;
00019 class Renderable;
00020
00021
00022
00023
00024
00025
00026 class GameObject:public Object{
00027 public :
00028 static const RTTI TYPE;
00029 virtual const RTTI& getType() const{ return TYPE; }
00030
00031 private:
00032 GameObject(GameObject const& object);
00033
00034 Transform* transform;
00035
00036 vector<Component*> components;
00037
00038 multimap<string,Component*> componentMap;
00039
00040 Renderable* meshRenderer;
00041
00042 Collider* collider;
00043
00044 Behaviour* behaviour;
00045
00046 Animation* animation;
00047 ParticleSystem* particleSystem;
00048
00049
00050 friend class boost::serialization::access;
00051 template<class Archive>
00052 void serialize(Archive& ar, const unsigned int version){
00053
00054 ar & boost::serialization::base_object<Object>(*this);
00055 ar & meshRenderer;
00056 for(unsigned int i = 0; i < components.size(); ++i)
00057 ar & components[i];
00058 ar & transform;
00059 }
00060
00061 public:
00062 GameObject();
00063
00064 ~GameObject();
00065
00066 void addComponent(Component* comp);
00067
00068 void setRenderer(Renderable* renderer);
00069 Renderable* getRenderer() const;
00070
00071 Transform* getTransform() const;
00072 void setTransform(Transform* trans);
00073
00074 Behaviour* getBehaviour() const;
00075 void setBehaviour(Behaviour* behav);
00076
00077 Collider* getCollider() const;
00078 void setCollider(Collider* collid);
00079
00080 Animation* getAnimation() const;
00081 void setAnimation(Animation* anim);
00082
00083 ParticleSystem* getParticleSystem() const;
00084 void setParticleSystem(ParticleSystem* anim);
00085
00086 void onCollisionEnter();
00087
00088 };
00089
00090 #endif // GAMEOBJECT_H_INCLUDED