diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.cpp b/Code/Game/GameLogic/AttatchmentMassDriver.cpp
new file mode 100644
index 00000000..fcee6afb
--- /dev/null
+++ b/Code/Game/GameLogic/AttatchmentMassDriver.cpp
@@ -0,0 +1,38 @@
+#include "AttatchmentMassDriver.h"
+
+using namespace GameLogic;
+
+struct AttatchmentMassDriver::PrivateData
+{
+ PrivateData()
+ {
+
+ }
+
+ ~PrivateData()
+ {
+
+ }
+
+}myData;
+
+
+AttatchmentMassDriver::AttatchmentMassDriver(void)
+{
+}
+
+
+AttatchmentMassDriver::~AttatchmentMassDriver(void)
+{
+}
+
+
+void AttatchmentMassDriver::ForcePush(const GameLogic::WEAPON_FIRE &fireInput)
+{
+
+}
+
+void AttatchmentMassDriver::UseAttatchment(const GameLogic::WEAPON_FIRE &fireInput)
+{
+
+}
diff --git a/Code/Game/GameLogic/AttatchmentMassDriver.h b/Code/Game/GameLogic/AttatchmentMassDriver.h
new file mode 100644
index 00000000..bc95c327
--- /dev/null
+++ b/Code/Game/GameLogic/AttatchmentMassDriver.h
@@ -0,0 +1,25 @@
+#ifndef ATTATCHMENTMASSDRIVER_H
+#define ATTATCHMENTMASSDRIVER_H
+#include "IAttatchment.h"
+namespace GameLogic
+{
+
+ class AttatchmentMassDriver : public IAttatchment
+ {
+ public:
+ AttatchmentMassDriver(void);
+ ~AttatchmentMassDriver(void);
+
+
+ void UseAttatchment(const WEAPON_FIRE &fireInput);
+
+ private:
+ void ForcePush(const WEAPON_FIRE &fireInput);
+
+ private:
+ struct PrivateData;
+ PrivateData *myData;
+ };
+}
+#endif
+
diff --git a/Code/Game/GameLogic/AttatchmentSocket.cpp b/Code/Game/GameLogic/AttatchmentSocket.cpp
new file mode 100644
index 00000000..86e0850b
--- /dev/null
+++ b/Code/Game/GameLogic/AttatchmentSocket.cpp
@@ -0,0 +1,34 @@
+#include "AttatchmentSocket.h"
+#include "IAttatchment.h"
+using namespace GameLogic;
+
+struct AttatchmentSocket::PrivateData
+{
+ PrivateData()
+ {
+
+ }
+
+ ~PrivateData()
+ {
+
+ }
+
+ IAttatchment *Attatchment;
+
+
+}myData;
+
+AttatchmentSocket::AttatchmentSocket(void)
+{
+}
+
+
+AttatchmentSocket::~AttatchmentSocket(void)
+{
+}
+
+IAttatchment* AttatchmentSocket::GetAttatchment()
+{
+ return myData->Attatchment;
+}
diff --git a/Code/Game/GameLogic/AttatchmentSocket.h b/Code/Game/GameLogic/AttatchmentSocket.h
new file mode 100644
index 00000000..1067e339
--- /dev/null
+++ b/Code/Game/GameLogic/AttatchmentSocket.h
@@ -0,0 +1,20 @@
+#ifndef ATTATCHMENTSOCKET_H
+#define ATTATCHMENTSOCKET_H
+#include "IAttatchment.h"
+namespace GameLogic
+{
+
+ class AttatchmentSocket
+ {
+ public:
+ AttatchmentSocket(void);
+ ~AttatchmentSocket(void);
+
+ IAttatchment* GetAttatchment();
+
+ private:
+ struct PrivateData;
+ PrivateData *myData;
+ };
+}
+#endif
\ No newline at end of file
diff --git a/Code/Game/GameLogic/GameLogic.vcxproj b/Code/Game/GameLogic/GameLogic.vcxproj
index 8afb5bb4..33fd6c92 100644
--- a/Code/Game/GameLogic/GameLogic.vcxproj
+++ b/Code/Game/GameLogic/GameLogic.vcxproj
@@ -166,12 +166,14 @@
+
+
-
-
+
+
@@ -180,12 +182,13 @@
+
+
-
-
+
diff --git a/Code/Game/GameLogic/GameLogicStates.h b/Code/Game/GameLogic/GameLogicStates.h
new file mode 100644
index 00000000..3c2b9997
--- /dev/null
+++ b/Code/Game/GameLogic/GameLogicStates.h
@@ -0,0 +1,41 @@
+#ifndef GAMELOGICSTATES_H
+#define GAMELOGICSTATES_H
+
+
+namespace GameLogic
+{
+ enum PLAYER_STATE
+ {
+ PLAYER_STATE_JUMPING = 0,
+ PLAYER_STATE_WALKING = 1,
+ PLAYER_STATE_IDLE = 2,
+ };
+
+ enum PLAYER_MOVEMENT
+ {
+ PLAYER_MOVEMENT_FORWARD = 0,
+ PLAYER_MOVEMENT_BACKWARD = 1,
+ PLAYER_MOVEMENT_LEFT = 2,
+ PLAYER_MOVEMENT_RIGHT = 4,
+ PLAYER_MOVEMENT_JUMP = 8,
+ };
+
+ enum WEAPON_FIRE
+ {
+ WEAPON_USE_PRIMARY_PRESS = 0,
+ WEAPON_USE_PRIMARY_RELEASE = 1,
+ WEAPON_USE_SECONDARY_PRESS = 2,
+ WEAPON_USE_SECONDARY_RELEASE = 4,
+ WEAPON_USE_UTILLITY_PRESS = 8,
+ WEAPON_USE_UTILLITY_RELEASE = 16,
+ };
+
+ enum WEAPON_STATE
+ {
+ WEAPON_STATE_FIREING = 0,
+ WEAPON_STATE_IDLE = 1,
+ WEAPON_STATE_RELOADING = 2,
+ };
+}
+
+#endif
\ No newline at end of file
diff --git a/Code/Game/GameLogic/IAttatchment.cpp b/Code/Game/GameLogic/IAttatchment.cpp
new file mode 100644
index 00000000..c1e2a997
--- /dev/null
+++ b/Code/Game/GameLogic/IAttatchment.cpp
@@ -0,0 +1,29 @@
+#include "IAttatchment.h"
+#include "AttatchmentSocket.h"
+
+using namespace GameLogic;
+
+struct IAttatchment::PrivateData
+{
+ PrivateData()
+ {
+
+ }
+
+ ~PrivateData()
+ {
+
+ }
+
+
+
+}myData;
+
+IAttatchment::IAttatchment(void)
+{
+}
+
+
+IAttatchment::~IAttatchment(void)
+{
+}
diff --git a/Code/Game/GameLogic/IAttatchment.h b/Code/Game/GameLogic/IAttatchment.h
new file mode 100644
index 00000000..c134026f
--- /dev/null
+++ b/Code/Game/GameLogic/IAttatchment.h
@@ -0,0 +1,25 @@
+#ifndef IATTATCHMENT_H
+#define IATTATCHMENT_H
+#include "GameLogicStates.h"
+
+namespace GameLogic
+{
+
+
+ class IAttatchment
+ {
+
+ public:
+
+ IAttatchment(void);
+ ~IAttatchment(void);
+
+ virtual void UseAttatchment(const WEAPON_FIRE &fireInput) = 0;
+
+ private:
+ struct PrivateData;
+ PrivateData *myData;
+
+ };
+}
+#endif
diff --git a/Code/Game/GameLogic/Player.cpp b/Code/Game/GameLogic/Player.cpp
index 6c514634..01046143 100644
--- a/Code/Game/GameLogic/Player.cpp
+++ b/Code/Game/GameLogic/Player.cpp
@@ -11,7 +11,14 @@ struct Player::PrivateData
PrivateData()
{
weapon = new Weapon();
+
+ life = 100;
+ playerState = PLAYER_STATE_IDLE;
+
+ rigidBody->SetSubscription(CollisionManager::PlayerCollision);
+
}
+
~PrivateData()
{
if (weapon)
@@ -19,9 +26,12 @@ struct Player::PrivateData
delete weapon;
}
}
-
+
int life;
Weapon *weapon;
+ PLAYER_STATE playerState;
+
+ ICustomBody *rigidBody;
}myData;
@@ -35,16 +45,81 @@ Player::~Player(void)
delete myData;
}
+/********************************************************
+* Updates the player(is this function needed?)
+********************************************************/
+
void Player::Update()
{
}
-void Player::Move()
+/********************************************************
+* Moves the player based on client input
+* Uses the physics to move the player by adding a force in the chosen direction
+* Uses the Jump() function if the player is to jump, this is becuase jumping requires additional logic compared to normal movement
+********************************************************/
+void Player::Move(const PLAYER_MOVEMENT &movement)
+{
+ switch(movement)
+ {
+ case PLAYER_MOVEMENT_FORWARD:
+ break;
+
+ case PLAYER_MOVEMENT_BACKWARD:
+ break;
+
+ case PLAYER_MOVEMENT_LEFT:
+ break;
+
+ case PLAYER_MOVEMENT_RIGHT:
+ break;
+
+ case PLAYER_MOVEMENT_JUMP:
+ Jump();
+ break;
+ }
+}
+/********************************************************
+* Uses the players weapon based on user input
+********************************************************/
+void Player::Shoot(const WEAPON_FIRE &fireInput)
+{
+ myData->weapon->UseWeapon(fireInput);
+}
+
+/********************************************************
+* Jumps if the player is currently not in a state of jumping
+* Applies a force upwards(current upwards)
+********************************************************/
+void Player::Jump()
{
}
-void Player::Shoot()
+
+bool Player::IsWalking()
+{
+ return (myData->playerState == PLAYER_STATE_WALKING);
+}
+bool Player::IsJumping()
+{
+ return (myData->playerState == PLAYER_STATE_JUMPING);
+}
+bool Player::IsIdle()
+{
+ return (myData->playerState == PLAYER_STATE_IDLE);
+}
+
+//Oyster::Math::Float3 Player::GetPos()
+//{
+// return myData->rigidBody->GetCenter();
+//}
+
+/********************************************************
+* Respawns the player on a new chosen position
+* This resets a set of variables such as life, ammo etcetc
+********************************************************/
+void Player::Respawn()
{
}
diff --git a/Code/Game/GameLogic/Player.h b/Code/Game/GameLogic/Player.h
index 439bbcd9..d4ce0a8d 100644
--- a/Code/Game/GameLogic/Player.h
+++ b/Code/Game/GameLogic/Player.h
@@ -3,6 +3,7 @@
//////////////////////////////////////////////////
#ifndef PLAYER_H
#define PLAYER_H
+#include "GameLogicStates.h"
namespace GameLogic
{
@@ -13,14 +14,18 @@ namespace GameLogic
Player(void);
~Player(void);
- /********************************************************
- * Update the position of the rigid body
- * This will be done with physics later
- ********************************************************/
void Update();
- void Move();
- void Shoot();
-
+ void Move(const PLAYER_MOVEMENT &movement);
+ void Shoot(const WEAPON_FIRE &fireInput);
+ void Jump();
+
+ bool IsWalking();
+ bool IsJumping();
+ bool IsIdle();
+
+ //Oyster::Math::Float3 GetPos();
+ void Respawn();
+
private:
struct PrivateData;
PrivateData *myData;
diff --git a/Code/Game/GameLogic/Weapon.cpp b/Code/Game/GameLogic/Weapon.cpp
index c335ae7b..b7a47998 100644
--- a/Code/Game/GameLogic/Weapon.cpp
+++ b/Code/Game/GameLogic/Weapon.cpp
@@ -1,4 +1,6 @@
#include "Weapon.h"
+#include "AttatchmentSocket.h"
+#include "AttatchmentMassDriver.h"
using namespace GameLogic;
@@ -6,7 +8,8 @@ struct Weapon::PrivateData
{
PrivateData()
{
-
+ weaponState = WEAPON_STATE_IDLE;
+ SelectedAttatchment = new AttatchmentMassDriver();
}
~PrivateData()
@@ -14,6 +17,13 @@ struct Weapon::PrivateData
}
+ WEAPON_STATE weaponState;
+
+ AttatchmentSocket **attatchmentSockets;
+ int nrOfAttatchmentSockets;
+
+ IAttatchment *SelectedAttatchment;
+
}myData;
Weapon::Weapon()
@@ -26,3 +36,34 @@ Weapon::~Weapon(void)
{
delete myData;
}
+
+/********************************************************
+* Uses the weapon based on the input given and the current state of the weapon
+********************************************************/
+void Weapon::UseWeapon(const WEAPON_FIRE &fireInput)
+{
+ myData->SelectedAttatchment->UseAttatchment(fireInput);
+}
+
+/********************************************************
+* Specific weapon usage implementation
+********************************************************/
+
+/********************************************************
+* Get functions for states
+********************************************************/
+bool Weapon::IsFireing()
+{
+ return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_FIREING);
+}
+
+bool Weapon::IsIdle()
+{
+ return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_IDLE);
+}
+
+bool Weapon::IsReloading()
+{
+ return (myData->weaponState == WEAPON_STATE::WEAPON_STATE_RELOADING);
+}
+
diff --git a/Code/Game/GameLogic/Weapon.h b/Code/Game/GameLogic/Weapon.h
index 527b0b73..74a408e9 100644
--- a/Code/Game/GameLogic/Weapon.h
+++ b/Code/Game/GameLogic/Weapon.h
@@ -3,6 +3,7 @@
//////////////////////////////////////////////////
#ifndef WEAPON_H
#define WEAPON_H
+#include "GameLogicStates.h"
namespace GameLogic
{
@@ -11,10 +12,20 @@ namespace GameLogic
{
public:
+
+
Weapon(void);
~Weapon(void);
- private:
+ void UseWeapon(const WEAPON_FIRE &fireInput);
+
+
+ bool IsFireing();
+ bool IsIdle();
+ bool IsReloading();
+
+
+ private:
struct PrivateData;
PrivateData *myData;
};