Danbias/Code/Game/GameLogic/Game_PlayerData.cpp

75 lines
2.0 KiB
C++
Raw Normal View History

#include "Game.h"
#include "Player.h"
using namespace GameLogic;
Game::PlayerData::PlayerData()
{
//set some stats that are appropriate to a player
Oyster::Physics::API::SimpleBodyDescription sbDesc;
2014-01-31 16:33:16 +01:00
sbDesc.centerPosition = Oyster::Math::Float3(0,308,0);
2014-02-05 15:54:48 +01:00
sbDesc.size = Oyster::Math::Float3(0.5f,2,1);
2014-01-31 10:58:03 +01:00
sbDesc.mass = 70;
2014-01-31 16:33:16 +01:00
sbDesc.restitutionCoeff = 0.5;
2014-02-05 09:06:33 +01:00
sbDesc.frictionCoeff_Static = 0.4;
sbDesc.frictionCoeff_Dynamic = 0.3;
2014-02-03 16:20:05 +01:00
sbDesc.rotation = Oyster::Math::Float3(0, Oyster::Math::pi, 0);
2014-02-03 10:42:40 +01:00
//create rigid body
2014-01-27 08:54:25 +01:00
Oyster::Physics::ICustomBody *rigidBody = Oyster::Physics::API::Instance().CreateRigidBody(sbDesc).Release();
//create player with this rigid body
this->player = new Player(rigidBody,Player::PlayerCollisionBefore, Player::PlayerCollision, OBJECT_TYPE::OBJECT_TYPE_PLAYER);
this->player->GetRigidBody()->SetCustomTag(this);
2014-02-03 16:20:05 +01:00
/*Oyster::Physics::ICustomBody::State state;
this->player->GetRigidBody()->GetState(state);
state.SetRotation(Oyster::Math::Float3(0, Oyster::Math::pi, 0));
this->player->GetRigidBody()->SetState(state);
2014-02-03 16:20:05 +01:00
player->EndFrame();*/
}
Game::PlayerData::PlayerData(int playerID,int teamID)
{
2014-01-20 15:47:52 +01:00
this->player = new Player();
}
Game::PlayerData::~PlayerData()
{
2014-01-20 15:47:52 +01:00
delete this->player;
}
void Game::PlayerData::Move(const PLAYER_MOVEMENT &movement)
{
this->player->Move(movement);
}
2014-01-16 11:07:45 +01:00
void Game::PlayerData::UseWeapon(const WEAPON_FIRE &usage)
{
2014-01-16 11:07:45 +01:00
this->player->UseWeapon(usage);
}
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-20 15:47:52 +01:00
OBJECT_TYPE Game::PlayerData::GetObjectType() const
{
2014-01-30 09:40:58 +01:00
return this->player->GetObjectType();
}
void Game::PlayerData::Rotate(const Oyster::Math3D::Float4 lookDir)
{
this->player->Rotate(lookDir);
}