2013-11-28 08:33:29 +01:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
//Created by Erik and Linda of the GameLogic team
|
|
|
|
//////////////////////////////////////////////////
|
|
|
|
|
|
|
|
|
2013-11-19 18:35:35 +01:00
|
|
|
#ifndef OBJECT_H
|
|
|
|
#define OBJECT_H
|
|
|
|
|
2013-12-12 09:36:14 +01:00
|
|
|
#include "GameLogicStates.h"
|
2014-01-28 15:04:25 +01:00
|
|
|
#include "GameAPI.h"
|
2014-01-10 10:08:42 +01:00
|
|
|
#include <PhysicsAPI.h>
|
2013-12-12 12:16:13 +01:00
|
|
|
|
2013-11-19 18:35:35 +01:00
|
|
|
namespace GameLogic
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
class Game;
|
|
|
|
|
2014-01-28 15:04:25 +01:00
|
|
|
class Object :public IObjectData
|
2013-11-19 18:35:35 +01:00
|
|
|
{
|
2014-02-19 10:36:45 +01:00
|
|
|
public:
|
|
|
|
typedef Oyster::Physics::ICustomBody::SubscriptMessage (*OnCollisionCallback)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss);
|
|
|
|
|
2013-11-29 09:23:00 +01:00
|
|
|
public:
|
2013-12-12 09:36:14 +01:00
|
|
|
Object();
|
2014-02-14 09:53:02 +01:00
|
|
|
Object(Oyster::Physics::ICustomBody *rigidBody, void (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
|
|
|
Object(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*collisionFuncAfter)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID);
|
2013-12-12 09:36:14 +01:00
|
|
|
~Object(void);
|
2013-11-19 18:35:35 +01:00
|
|
|
|
2014-02-19 10:36:45 +01:00
|
|
|
inline ObjectSpecialType GetObjectType() const override { return this->type; }
|
|
|
|
inline int GetID() const override { return this->objectID; }
|
|
|
|
inline Oyster::Math::Float3 GetScale() override { return this->scale; }
|
|
|
|
inline Oyster::Math::Float3 GetPosition() override;
|
|
|
|
inline Oyster::Math::Quaternion GetRotation() override;
|
|
|
|
inline Oyster::Math::Float4x4 GetOrientation() override;
|
|
|
|
inline Oyster::Physics::ICustomBody* GetRigidBody() { return this->rigidBody; }
|
|
|
|
inline Oyster::Math::Float GetExtraDamageOnCollision() { return this->extraDamageOnCollision; }
|
2014-01-28 15:04:25 +01:00
|
|
|
|
2014-02-19 10:36:45 +01:00
|
|
|
virtual void BeginFrame() { };
|
|
|
|
virtual void EndFrame() { };
|
2013-12-12 12:16:13 +01:00
|
|
|
|
2014-02-19 10:36:45 +01:00
|
|
|
void SetOnCollision(OnCollisionCallback func);
|
2014-02-14 09:53:02 +01:00
|
|
|
|
2014-02-19 10:36:45 +01:00
|
|
|
static Oyster::Physics::ICustomBody::SubscriptMessage DefaultOnCollision(Oyster::Physics::ICustomBody *rigidBodyObject, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
2014-01-20 15:47:52 +01:00
|
|
|
|
2013-11-19 18:35:35 +01:00
|
|
|
protected:
|
2013-11-28 09:26:29 +01:00
|
|
|
Oyster::Physics::ICustomBody *rigidBody;
|
2014-01-09 13:06:18 +01:00
|
|
|
|
2014-01-20 15:47:52 +01:00
|
|
|
static const Game* gameInstance;
|
2014-02-19 10:36:45 +01:00
|
|
|
|
|
|
|
Oyster::Math::Float3 lookDirection; //The look direction for the camera
|
|
|
|
Oyster::Math::Float3 forwardDirection; //The forward direction of the rigid body
|
|
|
|
Oyster::Math::Float3 scale; //The scale of both rigid body and the mesh
|
2014-02-14 09:53:02 +01:00
|
|
|
|
|
|
|
ObjectSpecialType type;
|
|
|
|
int objectID;
|
2014-02-14 10:56:38 +01:00
|
|
|
|
|
|
|
Oyster::Math::Float extraDamageOnCollision;
|
2013-11-19 18:35:35 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
#endif
|