|
Bullet
Class header file: BWAPI/Bullet.h The Bullet class is used to get information about individual bullets, missiles, spells, and generally any sort of non-melee attack. Unlike Units, Bullet objects are reused after they are destroyed, however the ID of the bullet is updated when it represents a new bullet. If Flag::CompleteMapInformation is disabled, then a bullet is accessible if and only if it is visible. If a bullet is not visible, Bullet::exists will return false, regardless of whether or not the bullet exists. This is because absolutely no state information on invisible enemy bullets is made available to the AI. If Flag::CompleteMapInformation is enabled, then all bullets that exist in the game are accessible, and Bullet::exists is accurate for all bullets. No message similar to AIModule::onUnitDestroy exists for bullets. To determine if a bullet has been destroyed, check to see if exists() is false or getID() has changed to a new value. Methods:
getIDint getID() const; Returns a unique ID for this bullet. getPlayerPlayer* getPlayer() const; Returns the player of the source unit, or NULL if the source unit has been destroyed or is otherwise inaccessible. getTypeBulletType getType() const; Returns the type of the bullet. getSourceUnit* getSource() const; Returns the unit that fired the bullet. If the unit is inaccessible (such as a cloaked or burrowed enemy unit with no detection around and complete map information disabled), this will return NULL. getPositionPosition getPosition() const; Returns the position of the bullet, or an invalid position if the bullet is inaccessible. getAngledouble getAngle() const; Returns the direction the bullet is facing/traveling in, measured in radians. An angle of 0 means the bullet is facing east/right. If the bullet is inaccessible this will return 0. getVelocityXdouble getVelocityX() const; Returns the x component of the bullet's velocity, measured in pixels per frame. If the bullet is inaccessible this will return 0. getVelocityYdouble getVelocityY() const; Returns the y component of the bullet's velocity, measured in pixels per frame. If the bullet is inaccessible this will return 0. getTargetUnit* getTarget() const; Returns the unit that the bullet is trying to hit. If the unit is inaccessible (such as a cloaked or burrowed enemy unit with no detection around and complete map information disabled), this will return NULL. If the bullet is inaccessible this will return NULL. getTargetPositionPosition getTargetPosition() const; Returns the target position of the bullet. If the bullet is inaccessible this will return an invalid position. getRemoveTimerint getRemoveTimer() const; Returns the maximum number of frames until this bullet is removed. Generally bullets hit their targets before this timer reaches 0. If the bullet is inaccessible this will return 0. existsbool exists() const; Returns true if the bullet is accessible. If Flag::CompleteMapInformation is enabled, all bullets that actually exist in the game will be accessible. If it is disabled, then only visible bullets will be accessible. isVisiblebool isVisible() const; bool isVisible(Player* player) const; Returns true if the bullet is visible. If Flag::CompleteMapInformation is enabled, you can also specify to which player you want to check visibility for, otherwise Game::self is used. | |
WHAT DOES IT MEAN WHEN ASKED IS A BULLET VISIBLE
It means if you can see it