GL - new weapon gun

This commit is contained in:
Erik Persson 2014-02-27 14:38:03 +01:00
commit ef3dd62ca3
2 changed files with 104 additions and 0 deletions

View File

@ -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);
}

View File

@ -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