2013-11-28 08:33:29 +01:00
|
|
|
//////////////////////////////////////////////////
|
|
|
|
//Created by Erik and Linda of the GameLogic team
|
|
|
|
//////////////////////////////////////////////////
|
2013-11-19 11:07:14 +01:00
|
|
|
#ifndef PLAYER_H
|
|
|
|
#define PLAYER_H
|
2014-01-15 11:03:25 +01:00
|
|
|
|
2013-12-10 09:57:05 +01:00
|
|
|
#include "GameLogicStates.h"
|
2013-12-10 11:17:25 +01:00
|
|
|
#include "OysterMath.h"
|
2014-01-20 08:40:41 +01:00
|
|
|
#include "DynamicObject.h"
|
2013-12-21 17:37:30 +01:00
|
|
|
|
2013-11-19 11:07:14 +01:00
|
|
|
|
|
|
|
namespace GameLogic
|
|
|
|
{
|
2014-01-15 11:03:25 +01:00
|
|
|
class Weapon;
|
2014-01-20 08:40:41 +01:00
|
|
|
class Player : public DynamicObject
|
2013-11-19 11:07:14 +01:00
|
|
|
{
|
|
|
|
public:
|
2013-12-05 11:50:39 +01:00
|
|
|
Player(void);
|
2014-02-14 09:53:02 +01:00
|
|
|
|
|
|
|
Player(Oyster::Physics::ICustomBody *rigidBody, void (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID);
|
|
|
|
Player(Oyster::Physics::ICustomBody *rigidBody, Oyster::Physics::ICustomBody::SubscriptMessage (*EventOnCollision)(Oyster::Physics::ICustomBody *proto,Oyster::Physics::ICustomBody *deuter,Oyster::Math::Float kineticEnergyLoss), ObjectSpecialType type, int objectID, int teamID);
|
2014-02-12 14:48:58 +01:00
|
|
|
|
2013-11-19 11:07:14 +01:00
|
|
|
~Player(void);
|
2014-02-14 09:53:02 +01:00
|
|
|
|
2013-12-18 08:30:58 +01:00
|
|
|
/********************************************************
|
|
|
|
* Moves the player based on input
|
|
|
|
* @param movement: enum value on what kind of action is to be taken
|
|
|
|
********************************************************/
|
2013-12-10 09:57:05 +01:00
|
|
|
void Move(const PLAYER_MOVEMENT &movement);
|
2013-12-18 08:30:58 +01:00
|
|
|
|
2013-12-20 09:42:02 +01:00
|
|
|
void MoveForward();
|
|
|
|
void MoveBackwards();
|
|
|
|
void MoveRight();
|
|
|
|
void MoveLeft();
|
|
|
|
|
2013-12-18 08:30:58 +01:00
|
|
|
/********************************************************
|
|
|
|
* Uses the weapon based on input
|
|
|
|
* @param fireInput: enum value on what kind of action is to be taken
|
|
|
|
********************************************************/
|
2014-01-16 11:17:19 +01:00
|
|
|
void UseWeapon(const WEAPON_FIRE &usage);
|
2013-12-10 09:57:05 +01:00
|
|
|
|
2013-12-18 08:30:58 +01:00
|
|
|
/********************************************************
|
|
|
|
* Respawns the player, this resets several stats and settings on the player
|
|
|
|
* @param spawnPoint: the coordinate in the world where the player is to spawn
|
|
|
|
********************************************************/
|
|
|
|
void Respawn(Oyster::Math::Float3 spawnPoint);
|
|
|
|
|
2014-01-21 16:11:02 +01:00
|
|
|
|
2014-02-12 13:11:35 +01:00
|
|
|
void Rotate(const Oyster::Math3D::Float3 lookDir, const Oyster::Math3D::Float3 right);
|
2014-01-21 16:08:55 +01:00
|
|
|
|
2014-01-21 15:46:54 +01:00
|
|
|
/********************************************************
|
|
|
|
* Collision function for player, this is to be sent to physics through the subscribe function with the rigidbody
|
|
|
|
* Will be called when the physics detect a collision
|
|
|
|
* @param rigidBodyPlayer: physics object of the player
|
|
|
|
* @param obj: physics object for the object that collided with the player
|
|
|
|
********************************************************/
|
2014-01-27 08:54:25 +01:00
|
|
|
static void PlayerCollision(Oyster::Physics::ICustomBody *rigidBodyPlayer, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
2014-01-21 15:46:54 +01:00
|
|
|
|
2013-12-18 08:30:58 +01:00
|
|
|
|
2013-12-10 09:57:05 +01:00
|
|
|
bool IsWalking();
|
|
|
|
bool IsJumping();
|
|
|
|
bool IsIdle();
|
|
|
|
|
2014-01-15 11:03:25 +01:00
|
|
|
Oyster::Math::Float3 GetPosition() const;
|
|
|
|
Oyster::Math::Float3 GetLookDir() const;
|
|
|
|
Oyster::Math::Float4x4 GetOrientation() const;
|
|
|
|
int GetTeamID() const;
|
|
|
|
PLAYER_STATE GetState() const;
|
2013-12-10 09:57:05 +01:00
|
|
|
|
2013-12-12 12:16:13 +01:00
|
|
|
void DamageLife(int damage);
|
|
|
|
|
2014-02-03 15:32:46 +01:00
|
|
|
void BeginFrame();
|
|
|
|
void EndFrame();
|
2014-02-05 11:46:04 +01:00
|
|
|
static Oyster::Physics::ICustomBody::SubscriptMessage PlayerCollisionAfter(Oyster::Physics::ICustomBody *rigidBodyLevel, Oyster::Physics::ICustomBody *obj, Oyster::Math::Float kineticEnergyLoss);
|
|
|
|
|
2014-01-15 11:03:25 +01:00
|
|
|
private:
|
2013-12-18 08:30:58 +01:00
|
|
|
void Jump();
|
2014-01-15 11:03:25 +01:00
|
|
|
|
2013-11-19 18:35:35 +01:00
|
|
|
private:
|
2014-02-14 09:53:02 +01:00
|
|
|
Oyster::Math::Float life;
|
2014-01-15 11:03:25 +01:00
|
|
|
int teamID;
|
|
|
|
Weapon *weapon;
|
|
|
|
PLAYER_STATE playerState;
|
2014-02-12 11:36:08 +01:00
|
|
|
Oyster::Math::Float3 lookDir;
|
2014-02-12 12:16:16 +01:00
|
|
|
float key_forward;
|
|
|
|
float key_backward;
|
|
|
|
float key_strafeRight;
|
|
|
|
float key_strafeLeft;
|
2014-02-12 13:11:35 +01:00
|
|
|
float key_jump;
|
2014-01-15 11:03:25 +01:00
|
|
|
|
2014-02-13 19:49:33 +01:00
|
|
|
|
|
|
|
Oyster::Math::Float3 moveDir;
|
|
|
|
Oyster::Math::Float moveSpeed;
|
|
|
|
Oyster::Math::Float3 previousMoveSpeed;
|
|
|
|
|
|
|
|
|
2014-01-21 15:46:54 +01:00
|
|
|
bool hasTakenDamage;
|
|
|
|
float invincibleCooldown;
|
2013-11-19 11:07:14 +01:00
|
|
|
};
|
|
|
|
}
|
|
|
|
#endif
|