2013-11-20 14:18:31 +01:00
|
|
|
#include "Weapon.h"
|
2013-12-10 09:57:05 +01:00
|
|
|
#include "AttatchmentSocket.h"
|
|
|
|
#include "AttatchmentMassDriver.h"
|
2013-11-20 14:18:31 +01:00
|
|
|
|
|
|
|
using namespace GameLogic;
|
|
|
|
|
2013-12-05 11:50:39 +01:00
|
|
|
struct Weapon::PrivateData
|
2013-11-20 14:18:31 +01:00
|
|
|
{
|
2013-12-05 11:50:39 +01:00
|
|
|
PrivateData()
|
|
|
|
{
|
2013-12-10 09:57:05 +01:00
|
|
|
weaponState = WEAPON_STATE_IDLE;
|
|
|
|
SelectedAttatchment = new AttatchmentMassDriver();
|
2013-12-05 11:50:39 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
~PrivateData()
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-12-10 09:57:05 +01:00
|
|
|
WEAPON_STATE weaponState;
|
|
|
|
|
|
|
|
AttatchmentSocket **attatchmentSockets;
|
|
|
|
int nrOfAttatchmentSockets;
|
|
|
|
|
|
|
|
IAttatchment *SelectedAttatchment;
|
|
|
|
|
2013-12-05 11:50:39 +01:00
|
|
|
}myData;
|
|
|
|
|
|
|
|
Weapon::Weapon()
|
|
|
|
{
|
|
|
|
myData = new PrivateData();
|
2013-11-20 14:18:31 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Weapon::~Weapon(void)
|
|
|
|
{
|
2013-12-05 11:50:39 +01:00
|
|
|
delete myData;
|
2013-11-20 14:18:31 +01:00
|
|
|
}
|
2013-12-10 09:57:05 +01:00
|
|
|
|
|
|
|
/********************************************************
|
|
|
|
* 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);
|
|
|
|
}
|
|
|
|
|