Merge branch 'GameLogic' of https://github.com/dean11/Danbias into GameLogic
This commit is contained in:
commit
f6ba81cd44
|
@ -10,7 +10,7 @@ using namespace GameLogic;
|
||||||
|
|
||||||
struct Level::PrivateData
|
struct Level::PrivateData
|
||||||
{
|
{
|
||||||
PrivateData()
|
PrivateData()
|
||||||
{
|
{
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,6 +23,8 @@ Object::Object()
|
||||||
this->objectID = GID();
|
this->objectID = GID();
|
||||||
|
|
||||||
this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN;
|
this->type = OBJECT_TYPE::OBJECT_TYPE_UNKNOWN;
|
||||||
|
|
||||||
|
rigidBody->GetState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
||||||
|
@ -40,6 +42,8 @@ Object::Object(void* collisionFunc, OBJECT_TYPE type)
|
||||||
this->objectID = GID();
|
this->objectID = GID();
|
||||||
|
|
||||||
this->type = type;
|
this->type = type;
|
||||||
|
|
||||||
|
rigidBody->GetState(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace GameLogic
|
||||||
int objectID;
|
int objectID;
|
||||||
protected:
|
protected:
|
||||||
Oyster::Physics::ICustomBody *rigidBody;
|
Oyster::Physics::ICustomBody *rigidBody;
|
||||||
Oyster::Physics::ICustomBody::State *state;
|
Oyster::Physics::ICustomBody::State state;
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,7 @@ struct Player::PrivateData
|
||||||
teamID = -1;
|
teamID = -1;
|
||||||
playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
|
|
||||||
lookDir = Oyster::Math::Float4(1,0,0);
|
lookDir = Oyster::Math::Float4(1,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
~PrivateData()
|
~PrivateData()
|
||||||
|
@ -75,23 +75,23 @@ void Player::Move(const PLAYER_MOVEMENT &movement)
|
||||||
|
|
||||||
void Player::MoveForward()
|
void Player::MoveForward()
|
||||||
{
|
{
|
||||||
state->ApplyLinearImpulse(myData->lookDir * 100);
|
state.ApplyLinearImpulse(myData->lookDir * 100);
|
||||||
}
|
}
|
||||||
void Player::MoveBackwards()
|
void Player::MoveBackwards()
|
||||||
{
|
{
|
||||||
state->ApplyLinearImpulse(-myData->lookDir * 100);
|
state.ApplyLinearImpulse(-myData->lookDir * 100);
|
||||||
}
|
}
|
||||||
void Player::MoveRight()
|
void Player::MoveRight()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
Oyster::Math::Float4 r = (-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
||||||
state->ApplyLinearImpulse(r * 100);
|
state.ApplyLinearImpulse(r * 100);
|
||||||
}
|
}
|
||||||
void Player::MoveLeft()
|
void Player::MoveLeft()
|
||||||
{
|
{
|
||||||
//Do cross product with forward vector and negative gravity vector
|
//Do cross product with forward vector and negative gravity vector
|
||||||
Oyster::Math::Float4 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
Oyster::Math::Float4 r = -(-rigidBody->GetGravityNormal()).Cross((Oyster::Math::Float3)myData->lookDir);
|
||||||
state->ApplyLinearImpulse(-r * 100);
|
state.ApplyLinearImpulse(-r * 100);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Player::UseWeapon(const WEAPON_FIRE &fireInput)
|
void Player::UseWeapon(const WEAPON_FIRE &fireInput)
|
||||||
|
@ -101,7 +101,7 @@ void Player::UseWeapon(const WEAPON_FIRE &fireInput)
|
||||||
|
|
||||||
void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
||||||
{
|
{
|
||||||
//API::Instance().SetCenter(rigidBody,spawnPoint);
|
|
||||||
myData->life = 100;
|
myData->life = 100;
|
||||||
myData->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
myData->playerState = PLAYER_STATE::PLAYER_STATE_IDLE;
|
||||||
myData->lookDir = Oyster::Math::Float4(1,0,0);
|
myData->lookDir = Oyster::Math::Float4(1,0,0);
|
||||||
|
@ -109,7 +109,7 @@ void Player::Respawn(Oyster::Math::Float3 spawnPoint)
|
||||||
|
|
||||||
void Player::Jump()
|
void Player::Jump()
|
||||||
{
|
{
|
||||||
//API::Instance().ApplyForceAt(rigidBody,rigidBody->GetCenter(),-Oyster::Math::Float3(0,1,0) * 100);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool Player::IsWalking()
|
bool Player::IsWalking()
|
||||||
|
@ -127,8 +127,7 @@ bool Player::IsIdle()
|
||||||
|
|
||||||
Oyster::Math::Float3 Player::GetPos()
|
Oyster::Math::Float3 Player::GetPos()
|
||||||
{
|
{
|
||||||
//return rigidBody->GetCenter();
|
return (Oyster::Math::Float3)state.GetCenterPosition();
|
||||||
return Oyster::Math::Float3(0,0,0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
Oyster::Math::Float3 Player::GetLookDir()
|
Oyster::Math::Float3 Player::GetLookDir()
|
||||||
|
|
|
@ -34,8 +34,6 @@ namespace GameLogic
|
||||||
bool IsValidSocket(int socketID);
|
bool IsValidSocket(int socketID);
|
||||||
|
|
||||||
int GetCurrentSocketID();
|
int GetCurrentSocketID();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
struct PrivateData;
|
struct PrivateData;
|
||||||
|
|
Loading…
Reference in New Issue