GL - new weapon gun
This commit is contained in:
commit
ef3dd62ca3
|
@ -0,0 +1,71 @@
|
|||
#include "AttatchmentGun.h"
|
||||
#include "PhysicsAPI.h"
|
||||
#include "GameLogicStates.h"
|
||||
#include "Game.h"
|
||||
using namespace GameLogic;
|
||||
|
||||
|
||||
|
||||
AttatchmentGun::AttatchmentGun(void)
|
||||
{
|
||||
this->owner = 0;
|
||||
this->damage = 0.0f;
|
||||
}
|
||||
|
||||
AttatchmentGun::AttatchmentGun(Player &owner)
|
||||
{
|
||||
this->owner = &owner;
|
||||
this->damage = standardDamage;
|
||||
}
|
||||
|
||||
|
||||
AttatchmentGun::~AttatchmentGun(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/********************************************************
|
||||
* Uses the attatchment and will from here switch case the different WEAPON_FIRE's that are to be used
|
||||
********************************************************/
|
||||
void AttatchmentGun::UseAttatchment(const GameLogic::WEAPON_FIRE &usage, float dt)
|
||||
{
|
||||
//switch case to determin what functionallity to use in the attatchment
|
||||
switch (usage)
|
||||
{
|
||||
case WEAPON_FIRE::WEAPON_USE_PRIMARY_PRESS:
|
||||
//skjut här
|
||||
break;
|
||||
|
||||
case WEAPON_FIRE::WEAPON_USE_SECONDARY_PRESS:
|
||||
break;
|
||||
|
||||
case WEAPON_USE_SECONDARY_RELEASE:
|
||||
break;
|
||||
|
||||
case WEAPON_FIRE::WEAPON_USE_UTILLITY_PRESS:
|
||||
break;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
void AttatchmentGun::Update(float dt)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void AttatchmentGun::ShootBullet(const WEAPON_FIRE &usage, float dt)
|
||||
{
|
||||
Oyster::Collision3D::Ray *hitRay;
|
||||
Oyster::Math::Float3 pos = owner->GetRigidBody()->GetState().centerPos;
|
||||
Oyster::Math::Float3 look = owner->GetLookDir().GetNormalized();
|
||||
Oyster::Math::Float hitDamage = this->damage;
|
||||
|
||||
firedBullet bullet;
|
||||
bullet.hitDamage = hitDamage;
|
||||
|
||||
hitRay = new Oyster::Collision3D::Ray(pos,look);
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
//////////////////////////////////////////////////
|
||||
//Created by Erik of the GameLogic team
|
||||
//////////////////////////////////////////////////
|
||||
#ifndef ATTATCHMENTGUN_H
|
||||
#define ATTATCHMENTGUN_H
|
||||
#include "IAttatchment.h"
|
||||
|
||||
|
||||
|
||||
namespace GameLogic
|
||||
{
|
||||
const Oyster::Math::Float standardDamage = 10;
|
||||
|
||||
class AttatchmentGun : public IAttatchment
|
||||
{
|
||||
public:
|
||||
AttatchmentGun(void);
|
||||
AttatchmentGun(Player &owner);
|
||||
~AttatchmentGun(void);
|
||||
|
||||
|
||||
void UseAttatchment(const WEAPON_FIRE &usage, float dt);
|
||||
void Update(float dt);
|
||||
|
||||
private:
|
||||
Oyster::Math::Float damage;
|
||||
private:
|
||||
void ShootBullet(const WEAPON_FIRE &usage, float dt);
|
||||
|
||||
};
|
||||
}
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue