![]() |
Castle Battle
1.0
|
Player handles everthing about player-releated context, that means Castle, Cannon, Target, Ball, Camera. More...
#include <player.h>
Public Member Functions | |
Player (IrrlichtDevice *device, scene::ISceneManager *smgr, video::IVideoDriver *driver, core::vector3df position, Physics *physics, Keyboard *keyboard, PLAYER_TYPE type, PLAYER_POSITION side=STRAIGHT) | |
Default constructor. More... | |
~Player () | |
scene::IMeshSceneNode * | getNode () |
Get cannon irrlicht node. More... | |
core::vector3df | getCannonRange () |
Get how far Z the cannon can SHOOT. More... | |
void | focusCamera () |
Set Active camera. More... | |
void | setCannon () |
Setup cannon based on player side. More... | |
bool | loop (HUD::HUD *hud) |
Main loop of player. More... | |
void | reset () |
Reset cannon angle and rotation. More... | |
bool | checkTarget () |
Check if target position is the same or it is changed. More... | |
Public Attributes | |
Keyboard * | keyboard |
Keyboard of the player. More... | |
core::stringw | name |
Name of the player. More... | |
PLAYER_TYPE | type |
Type of player PLAYER_TYPE. More... | |
Private Attributes | |
scene::ISceneManager * | smgr |
video::IVideoDriver * | driver |
irr::IrrlichtDevice * | device |
Camera * | camera |
Main camera of the player. More... | |
Physics * | physics |
Castle * | castle |
Castle of the player. More... | |
Cannon * | cannon |
Cannon of the player. More... | |
PLAYER_POSITION | side |
Side of the player PLAYER_POSITION. More... | |
Player handles everthing about player-releated context, that means Castle, Cannon, Target, Ball, Camera.
There are 2 type of player: AI or HUMAN. Only HUMAN is available for now. This class will build castle, setting up cannons, handles user inputs.
Player::Player | ( | IrrlichtDevice * | device, |
scene::ISceneManager * | smgr, | ||
video::IVideoDriver * | driver, | ||
core::vector3df | position, | ||
Physics * | physics, | ||
Keyboard * | keyboard, | ||
PLAYER_TYPE | type, | ||
PLAYER_POSITION | side = STRAIGHT |
||
) |
Default constructor.
This Will initialize cannon, castle and keyboard.
position | vector3df position of the castle. |
keyboard | ::Keyboard keyboard map of the player |
type | PLAYER_TYPE type of player |
side | PLAYER_POSITION side of player |
bool Player::checkTarget | ( | ) |
Check if target position is the same or it is changed.
void Player::focusCamera | ( | ) |
Set Active camera.
core::vector3df Player::getCannonRange | ( | ) |
Get how far Z the cannon can SHOOT.
The value is random withing cannon power. It is used to setup the second castle position
scene::IMeshSceneNode * Player::getNode | ( | ) |
Get cannon irrlicht node.
bool Player::loop | ( | HUD::HUD * | hud | ) |
Main loop of player.
hud | HUD hud of player. |
void Player::reset | ( | ) |
Reset cannon angle and rotation.
void Player::setCannon | ( | ) |
Setup cannon based on player side.
|
private |
Main camera of the player.
|
private |
|
private |
Keyboard* Player::keyboard |
Keyboard of the player.
core::stringw Player::name |
Name of the player.
|
private |
|
private |
Side of the player PLAYER_POSITION.
|
private |
PLAYER_TYPE Player::type |
Type of player PLAYER_TYPE.