2014-01-14 10:28:12 +01:00
|
|
|
#include "Game.h"
|
|
|
|
#include "Player.h"
|
|
|
|
|
|
|
|
using namespace GameLogic;
|
|
|
|
|
|
|
|
Game::PlayerData::PlayerData()
|
2014-01-29 14:33:21 +01:00
|
|
|
{
|
2014-01-27 13:54:57 +01:00
|
|
|
//set some stats that are appropriate to a player
|
2014-01-29 14:33:21 +01:00
|
|
|
Oyster::Physics::API::SimpleBodyDescription sbDesc;
|
|
|
|
sbDesc.centerPosition = Oyster::Math::Float3(0,15,0);
|
|
|
|
sbDesc.size = Oyster::Math::Float3(4,7,4);
|
|
|
|
|
2014-01-29 13:18:17 +01:00
|
|
|
//create rigid body
|
2014-01-27 08:54:25 +01:00
|
|
|
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
|
2014-01-29 14:33:21 +01:00
|
|
|
|
2014-01-29 13:18:17 +01:00
|
|
|
//create player with this rigid body
|
2014-01-29 14:33:21 +01:00
|
|
|
this->player = new Player(rigidBody,Object::DefaultCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER);
|
2014-01-21 09:52:48 +01:00
|
|
|
this->player->GetRigidBody()->SetCustomTag(this);
|
2014-01-29 14:33:21 +01:00
|
|
|
|
2014-01-14 10:28:12 +01:00
|
|
|
}
|
2014-01-15 11:03:25 +01:00
|
|
|
Game::PlayerData::PlayerData(int playerID,int teamID)
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
this->player = new Player();
|
2014-01-15 11:03:25 +01:00
|
|
|
}
|
|
|
|
Game::PlayerData::~PlayerData()
|
|
|
|
{
|
2014-01-20 15:47:52 +01:00
|
|
|
delete this->player;
|
2014-01-15 11:03:25 +01:00
|
|
|
}
|
|
|
|
|
2014-01-28 15:04:25 +01:00
|
|
|
void Game::PlayerData::Move(const PLAYER_MOVEMENT &movement){
|
2014-01-15 11:03:25 +01:00
|
|
|
this->player->Move(movement);
|
|
|
|
}
|
2014-01-16 11:07:45 +01:00
|
|
|
void Game::PlayerData::UseWeapon(const WEAPON_FIRE &usage)
|
2014-01-14 10:28:12 +01:00
|
|
|
{
|
2014-01-16 11:07:45 +01:00
|
|
|
this->player->UseWeapon(usage);
|
2014-01-14 10:28:12 +01:00
|
|
|
}
|
2014-01-15 11:03:25 +01:00
|
|
|
Oyster::Math::Float3 Game::PlayerData::GetPosition()
|
|
|
|
{
|
|
|
|
return this->player->GetPosition();
|
|
|
|
}
|
|
|
|
Oyster::Math::Float4x4 Game::PlayerData::GetOrientation()
|
|
|
|
{
|
|
|
|
return this->player->GetOrientation();
|
|
|
|
}
|
|
|
|
PLAYER_STATE Game::PlayerData::GetState() const
|
|
|
|
{
|
|
|
|
return this->player->GetState();
|
|
|
|
}
|
|
|
|
int Game::PlayerData::GetID() const
|
|
|
|
{
|
|
|
|
return this->player->GetID();
|
|
|
|
}
|
|
|
|
int Game::PlayerData::GetTeamID() const
|
|
|
|
{
|
|
|
|
return this->player->GetTeamID();
|
2014-01-20 15:47:52 +01:00
|
|
|
}
|
2014-01-28 15:04:25 +01:00
|
|
|
|
|
|
|
OBJECT_TYPE Game::PlayerData::GetType() const
|
2014-01-20 15:47:52 +01:00
|
|
|
{
|
|
|
|
return this->player->GetType();
|
2014-01-21 09:52:48 +01:00
|
|
|
}
|
2014-01-23 09:24:55 +01:00
|
|
|
void Game::PlayerData::Rotate(const Oyster::Math3D::Float3 lookDir)
|
2014-01-21 09:52:48 +01:00
|
|
|
{
|
2014-01-28 15:04:25 +01:00
|
|
|
this->player->Rotate(lookDir);
|
2014-01-15 11:03:25 +01:00
|
|
|
}
|