2013-11-28 08:33:29 +01:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
//Created by Erik and Linda of the GameLogic team
|
|
|
|
//////////////////////////////////////////////////
|
2013-11-19 11:07:14 +01:00
|
|
|
#ifndef LEVEL_H
|
|
|
|
#define LEVEL_H
|
2013-12-13 11:11:51 +01:00
|
|
|
#include <string>
|
2014-01-20 15:47:52 +01:00
|
|
|
|
|
|
|
#include "Player.h"
|
|
|
|
#include "StaticObject.h"
|
|
|
|
#include "DynamicObject.h"
|
2014-02-10 14:00:14 +01:00
|
|
|
#include "GameModeType.h"
|
2014-02-27 11:35:32 +01:00
|
|
|
#include "SpawnPoint.h"
|
2014-02-14 10:32:41 +01:00
|
|
|
|
2013-12-18 08:30:58 +01:00
|
|
|
#include "Player.h"
|
2014-01-20 15:47:52 +01:00
|
|
|
#include "PhysicsAPI.h"
|
|
|
|
#include "TeamManager.h"
|
|
|
|
#include "DynamicArray.h"
|
2014-02-19 11:00:16 +01:00
|
|
|
#include "LevelLoader.h"
|
2013-11-19 11:07:14 +01:00
|
|
|
|
2014-02-25 16:10:02 +01:00
|
|
|
#include "PickupSystem\PickupSystem.h"
|
|
|
|
#include "PickupSystem\PickupHealth.h"
|
|
|
|
|
2014-02-25 11:46:05 +01:00
|
|
|
const int DEATH_TIMER = 5;
|
2013-11-19 11:07:14 +01:00
|
|
|
namespace GameLogic
|
|
|
|
{
|
|
|
|
|
|
|
|
class Level
|
|
|
|
{
|
|
|
|
|
|
|
|
public:
|
|
|
|
Level(void);
|
|
|
|
~Level(void);
|
|
|
|
|
2013-12-18 08:30:58 +01:00
|
|
|
/********************************************************
|
|
|
|
* Initiates a level for players to play on
|
|
|
|
* @param levelPath: Path to a file that contains all information on the level
|
|
|
|
********************************************************/
|
2014-02-18 21:50:51 +01:00
|
|
|
bool InitiateLevel(std::wstring levelPath);
|
2014-02-13 16:33:26 +01:00
|
|
|
Oyster::Physics::ICustomBody* InitRigidBodyCube( const ObjectHeader* obj);
|
|
|
|
Oyster::Physics::ICustomBody* InitRigidBodySphere( const ObjectHeader* obj);
|
2014-02-26 14:06:02 +01:00
|
|
|
Oyster::Physics::ICustomBody* InitRigidBodyMesh( const ObjectHeader* obj);
|
|
|
|
|
2013-12-12 09:36:14 +01:00
|
|
|
|
2014-02-20 08:33:07 +01:00
|
|
|
Object* CreateGameObj(ObjectHeader* obj, Oyster::Physics::ICustomBody* rigidBody);
|
2013-12-18 08:30:58 +01:00
|
|
|
/********************************************************
|
|
|
|
* Creates a team in the level
|
|
|
|
* @param teamSize: The size of the team you want to create
|
|
|
|
********************************************************/
|
|
|
|
void CreateTeam(int teamSize);
|
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* Adds a player to a team
|
|
|
|
* @param player: The player you want to add to the team
|
|
|
|
* @param teamID: ArrayPos of the team you want to add the player to
|
|
|
|
********************************************************/
|
|
|
|
void AddPlayerToTeam(Player *player, int teamID);
|
2014-02-25 11:46:05 +01:00
|
|
|
void AddPlayerToGame(Player *player);
|
|
|
|
void RemovePlayerFromGame(Player *player);
|
2013-12-18 08:30:58 +01:00
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* Respawns a player on a random teammate
|
|
|
|
* @param player: The player you want to respawn
|
|
|
|
********************************************************/
|
|
|
|
void RespawnPlayer(Player *player);
|
|
|
|
|
2014-01-21 15:46:54 +01:00
|
|
|
/********************************************************
|
|
|
|
* Collision function for level, this is to be sent to physics through the subscribe function with the rigidbody
|
|
|
|
* Will be called when the physics detect a collision
|
|
|
|
* @param rigidBodyLevel: physics object of the level
|
|
|
|
* @param obj: physics object for the object that collided with the level
|
|
|
|
********************************************************/
|
2014-01-29 14:33:21 +01:00
|
|
|
static Oyster::Physics::ICustomBody::SubscriptMessage LevelCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
2014-02-05 11:46:04 +01:00
|
|
|
|
2014-02-25 11:46:05 +01:00
|
|
|
void Update(float deltaTime);
|
|
|
|
|
2014-02-05 11:46:04 +01:00
|
|
|
int getNrOfDynamicObj();
|
2014-01-28 15:04:25 +01:00
|
|
|
Object* GetObj( int ID ) const;
|
2014-02-21 15:42:09 +01:00
|
|
|
|
2014-02-25 11:46:05 +01:00
|
|
|
static void PlayerDied( Player* player );
|
2014-01-28 15:04:25 +01:00
|
|
|
static void PhysicsOnMoveLevel(const Oyster::Physics::ICustomBody *object);
|
|
|
|
|
2014-02-26 11:09:24 +01:00
|
|
|
Utility::DynamicMemory::DynamicArray<Player*> GetPlayers();
|
2014-02-25 11:46:05 +01:00
|
|
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> GetStaticObjects();
|
|
|
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> GetDynamicObject();
|
2014-01-21 15:46:54 +01:00
|
|
|
|
2014-02-25 11:46:05 +01:00
|
|
|
private:
|
2014-02-26 11:09:24 +01:00
|
|
|
Utility::DynamicMemory::DynamicArray<Player*> playerObjects;
|
2014-01-20 15:47:52 +01:00
|
|
|
TeamManager teamManager;
|
|
|
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<StaticObject>> staticObjects;
|
|
|
|
Utility::DynamicMemory::DynamicArray<Utility::DynamicMemory::SmartPointer<DynamicObject>> dynamicObjects;
|
2014-02-10 14:00:14 +01:00
|
|
|
GameModeType gameMode;
|
2014-02-26 11:09:24 +01:00
|
|
|
int objIDCounter;
|
2014-02-27 11:35:32 +01:00
|
|
|
SpawnPoint spawnPoints;
|
2014-02-25 16:10:02 +01:00
|
|
|
PickupSystem pickupSystem;
|
2013-11-19 11:07:14 +01:00
|
|
|
|
|
|
|
};
|
|
|
|
|
|
|
|
}
|
|
|
|
#endif
|