SC2API
An API for AI for StarCraft II
Public Types | Public Attributes | List of all members
sc2::Unit Class Reference

A unit. Could be a structure, a worker or a military unit. More...

#include <sc2_unit.h>

Public Types

enum  DisplayType { Visible = 1, Snapshot = 2, Hidden = 3 }
 If the unit is shown on screen or not. More...
 
enum  Alliance { Self = 1, Ally = 2, Neutral = 3, Enemy = 4 }
 Relationship to this player. More...
 
enum  CloakState { Cloaked = 1, CloakedDetected = 2, NotCloaked = 3, Unknown = 4 }
 Unit cloak state. More...
 

Public Attributes

DisplayType display_type
 If the unit is shown on screen or not.
 
Alliance alliance
 Relationship of the unit to this player.
 
Tag tag
 A unique identifier for the instance of a unit.
 
UnitTypeID unit_type
 An identifier of the type of unit.
 
int owner
 Which player owns a unit.
 
Point3D pos
 Position of the unit in the world.
 
float facing
 Direction the unit faces in radians (1 radian == 57.296 degrees)
 
float radius
 Radius of the unit.
 
float build_progress
 Gives progress under construction. Range: [0.0, 1.0]. 1.0 == finished.
 
CloakState cloak
 If the unit is cloaked.
 
float detect_range
 Range of detector for detector units.
 
float radar_range
 Range of radar for units that are radar units.
 
bool is_selected
 If the unit is in the current selection of the player.
 
bool is_on_screen
 Visible and within the camera frustum.
 
bool is_blip
 Detected by sensor tower.
 
float health
 Health of the unit. Not set for snapshots.
 
float health_max
 Max health for the unit. Not set for snapshots.
 
float shield
 Shield of the unit. Not set for snapshots.
 
float shield_max
 Max shield of the unit. Not set for snapshots.
 
float energy
 Energy of the unit. Not set for snapshots.
 
float energy_max
 Max energy of the unit. Not set for snapshots.
 
int mineral_contents
 Amount of minerals if the unit is a mineral field. Not set for snapshots.
 
int vespene_contents
 Amount of vespene if the unit is a geyser. Not set for snapshots.
 
bool is_flying
 If the unit is flying. Not set for snapshots.
 
bool is_burrowed
 If the unit is burrowed. Not set for snapshots.
 
float weapon_cooldown
 Time remaining for a weapon on cooldown. Not set for snapshots.
 
std::vector< UnitOrderorders
 Orders on a unit. Only valid for this player's units.
 
Tag add_on_tag
 Add-on like a tech lab or reactor. Only valid for this player's units.
 
std::vector< PassengerUnitpassengers
 Passengers in this transport. Only valid for this player's units.
 
int cargo_space_taken
 Number of cargo slots used in the transport. Only valid for this player's units.
 
int cargo_space_max
 Number of cargo slots available for a transport. Only valid for this player's units.
 
int assigned_harvesters
 Number of harvesters associated with a town hall (e.g., Command Center). Only valid for this player's units.
 
int ideal_harvesters
 Number of harvesters that can be assigned to a town hall (e.g., Command Center). Only valid for this player's units.
 
Tag engaged_target_tag
 Target unit of a unit. Only valid for this player's units.
 
std::vector< BuffIDbuffs
 Buffs on this unit. Only valid for this player's units.
 
bool is_powered
 Whether the unit is powered by a pylon.
 
bool is_alive
 Whether the unit is alive or not.
 
uint32_t last_seen_game_loop
 The last time the unit was seen.
 

Detailed Description

A unit. Could be a structure, a worker or a military unit.

Member Enumeration Documentation

Relationship to this player.

Enumerator
Self 

Belongs to the player.

Ally 

Ally of the player.

Neutral 

A neutral unit, usually a non-player unit like a mineral field.

Enemy 

Enemy of the player.

Unit cloak state.

Enumerator
Cloaked 

Cloaked, invisible to enemies until detected.

CloakedDetected 

Cloaked enemy, but detected.

NotCloaked 

No cloaking.

Unknown 

Could not determine cloaking state.

If the unit is shown on screen or not.

Enumerator
Visible 

Unit will be visible.

Snapshot 

Unit is represented by a snapshot in the fog-of-war. This is for units that don't belong to the player. The actual unit may be in a different location or state.

Hidden 

Unit will be hidden to enemies.


The documentation for this class was generated from the following file: