-
Notifications
You must be signed in to change notification settings - Fork 0
/
PowerUp.cpp
63 lines (58 loc) · 1.88 KB
/
PowerUp.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
#include "PowerUp.h"
/// <summary>
/// Must be called before launch.
/// </summary>
/// <param name="type">The type of power up this projectile should be.</param>
void PowerUp::setPowerUp ( const POWER_UP_TYPE type )
{
if ( m_active )
{
// can not change power up type on an active power up.
return;
}
if ( type == POWER_UP_TYPE::UNSET || type >= POWER_UP_TYPE::NO_POWER_UP )
{
m_powerUpType = POWER_UP_TYPE::UNSET;
return;
}
m_powerUpType = type;
}
void PowerUp::launch ( const Vector2Int startGridPosition, const float speed )
{
// Only launch if the power up has been set.
if ( m_powerUpType > POWER_UP_TYPE::UNSET && m_powerUpType < POWER_UP_TYPE::NO_POWER_UP )
{
switch ( m_powerUpType )
{
case POWER_UP_TYPE::PADDLE_SPEED_INCREASE:
m_symbol [ 0 ].UnicodeChar = '>';
m_symbol [ 0 ].Attributes = CellColour::Fore_White | CellColour::Back_Green;
break;
case POWER_UP_TYPE::PADDLE_SPEED_DECREASE:
m_symbol [ 0 ].UnicodeChar = '<';
m_symbol [ 0 ].Attributes = CellColour::Fore_White | CellColour::Back_Red;
break;
case POWER_UP_TYPE::PADDLE_INCREASE:
m_symbol [ 0 ].UnicodeChar = '+';
m_symbol [ 0 ].Attributes = CellColour::Fore_White | CellColour::Back_Green;
break;
case POWER_UP_TYPE::PADDLE_DECREASE:
m_symbol [ 0 ].UnicodeChar = '-';
m_symbol [ 0 ].Attributes = CellColour::Fore_White | CellColour::Back_Red;
break;
case POWER_UP_TYPE::BALL_MULTIPLY:
m_symbol [ 0 ].UnicodeChar = '*';
m_symbol [ 0 ].Attributes = CellColour::Fore_White | CellColour::Back_Green;
break;
case POWER_UP_TYPE::BALL_PENETRATE:
m_symbol [ 0 ].UnicodeChar = '!';
m_symbol [ 0 ].Attributes = CellColour::Fore_White | CellColour::Back_Green;
break;
default:
m_symbol [ 0 ].UnicodeChar = '?';
m_symbol [ 0 ].Attributes = CellColour::Fore_White;
break;
}
Projectile::launch ( startGridPosition, speed );
}
}