#include <Missile.hpp>
|
| Missile (thor::ParticleSystem &particleSystem, std::function< void()> destructCallback, const Ship *const target, sf::Vector2f const &position, sf::Vector2f const &direction, const float maxSpeed=4.f, const float acceleration=0.1f, const float turnSpeed=2.f) |
|
| ~Missile () |
| Disconnects emitter from particle system and invokes destructCallback_. More...
|
|
virtual void | update () override |
| Turns to face target while thrusting forward. More...
|
|
void | setForward (sf::Vector2f const &direction) |
|
| Bullet (sf::Vector2f const &position, sf::Vector2f const &direction, const float speed=10.f) |
|
| ~Bullet () |
|
bool | isActive () const |
| Is the bullet active? More...
|
|
void | setActive (bool active) |
|
int | getDamage () const |
| Gets the damage that the bullet will deal to something it hits. More...
|
|
Faction | getFaction () const |
|
void | setFaction (Faction faction) |
|
Missile::Missile |
( |
thor::ParticleSystem & |
particleSystem, |
|
|
std::function< void()> |
destructCallback, |
|
|
const Ship *const |
target, |
|
|
sf::Vector2f const & |
position, |
|
|
sf::Vector2f const & |
direction, |
|
|
const float |
maxSpeed = 4.f , |
|
|
const float |
acceleration = 0.1f , |
|
|
const float |
turnSpeed = 2.f |
|
) |
| |
- Parameters
-
particleSystem | The particle system to connect the Missile's emitter to |
destructCallback | Called when the missile is destroyed. See Missile::~Missile() |
target | The target for the missile |
position | Initial position |
direction | Launch direction |
Disconnects emitter from particle system and invokes destructCallback_.
void Missile::setForward |
( |
sf::Vector2f const & |
direction | ) |
|
Turns to face target while thrusting forward.
Reimplemented from Bullet.
void Missile::updateParticleEmitter |
( |
| ) |
|
|
protected |
const float Missile::ACCELERATION_ |
|
protected |
How fast (per tick) the missile accelerates.
thor::Connection Missile::connection_ |
|
private |
Connection of emitter to particle system.
const std::function<void()> Missile::destructCallback_ |
|
private |
Used to notify firing ship that this missile has exploded.
bool Missile::isAccelerating_ |
|
protected |
True if the missile has yet to reach max speed.
const float Missile::MAX_SPEED_ |
|
protected |
Maximum speed of the missile. Higher value == larger turning circle.
thor::UniversalEmitter Missile::particleEmitter_ |
|
protected |
Emitter for creating particles.
const Ship* const Missile::TARGET_ |
|
protected |
const float Missile::TURN_SPEED_ |
|
protected |
Has quickly the missile can turn. Higher value == tighter turning circle.
The documentation for this class was generated from the following files: