2013-11-19 11:07:14 +01:00
|
|
|
#include "Player.h"
|
2013-11-25 11:03:06 +01:00
|
|
|
#include "OysterMath.h"
|
|
|
|
|
2013-11-19 11:07:14 +01:00
|
|
|
|
|
|
|
using namespace GameLogic;
|
2013-11-25 11:03:06 +01:00
|
|
|
using namespace Oyster::Physics;
|
|
|
|
using namespace Utility::DynamicMemory;
|
|
|
|
|
|
|
|
|
|
|
|
|
2013-11-19 11:07:14 +01:00
|
|
|
|
|
|
|
Player::Player(void)
|
2013-11-21 12:05:39 +01:00
|
|
|
:Object()
|
2013-11-19 11:07:14 +01:00
|
|
|
{
|
2013-11-26 11:30:49 +01:00
|
|
|
life = 100;
|
2013-11-27 16:17:47 +01:00
|
|
|
|
|
|
|
Oyster::Physics::ICustomBody* temp = rigidBody = API::Instance().CreateSimpleRigidBody().Release();
|
|
|
|
|
|
|
|
rigidBody->SetCenter(Oyster::Math::Float3(50,0,0));
|
|
|
|
rigidBody->SetMass_KeepMomentum(30);
|
|
|
|
rigidBody->SetSize(Oyster::Math::Float3(2,2,2));
|
|
|
|
rigidBody->SetSubscription(true);
|
|
|
|
rigidBody->SetMomentOfInertiaTensor_KeepMomentum(Oyster::Math::Float4x4( Oyster::Physics::MomentOfInertia::CreateCuboidMatrix(30, 2, 2, 2)));
|
|
|
|
|
|
|
|
//API::Instance().AddObject(temp);
|
2013-11-19 11:07:14 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Player::~Player(void)
|
|
|
|
{
|
2013-11-27 16:17:47 +01:00
|
|
|
delete this->rigidBody;
|
2013-11-21 12:05:39 +01:00
|
|
|
}
|
2013-11-27 16:17:47 +01:00
|
|
|
void Player::Update(keyInput keyPressed)
|
2013-11-21 12:05:39 +01:00
|
|
|
{
|
2013-11-27 16:17:47 +01:00
|
|
|
if(keyPressed != keyInput_none)
|
|
|
|
{
|
|
|
|
Move();
|
|
|
|
|
|
|
|
if(keyPressed == keyInput_A)
|
|
|
|
{
|
|
|
|
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
|
|
|
pos.x -= 0.1;
|
|
|
|
rigidBody->SetCenter(pos);
|
|
|
|
}
|
|
|
|
if(keyPressed == keyInput_D)
|
|
|
|
{
|
|
|
|
Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
|
|
|
pos.x += 0.1;
|
|
|
|
rigidBody->SetCenter(pos);
|
|
|
|
}
|
|
|
|
}
|
2013-11-26 11:30:49 +01:00
|
|
|
|
2013-11-21 12:05:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
void Player::Move()
|
|
|
|
{
|
2013-11-27 16:17:47 +01:00
|
|
|
//API::Instance().Update();
|
|
|
|
/*Oyster::Math::Float3 pos = this->rigidBody->GetCenter();
|
|
|
|
pos.x += 0.1;
|
|
|
|
rigidBody->SetCenter(pos);*/
|
|
|
|
//API::Instance().SetCenter(rigidBody, pos);
|
2013-11-21 12:05:39 +01:00
|
|
|
}
|
|
|
|
void Player::Shoot()
|
|
|
|
{
|
|
|
|
|
2013-11-19 11:07:14 +01:00
|
|
|
}
|