Enums - ItsDeltin/Overwatch-Script-To-Workshop GitHub Wiki
Enums
Enums are a set of constants. Calling an enum outputs as a number. In the below, PowerupType.Wall
will output as 0, PowerupType.DamageBoost
outputs as 3.
enum PowerupType
{
Wall,
JumpBoost,
SpeedBoost,
DamageBoost
}
You can get a random enum value by casting.
PowerupType powerup = <PowerupType>RandomInteger(0, 3)
You can also store arbitrary values in enums (do note that this means you won't be able to cast integers to enums anymore):
enum DeathResponses {
Annoyed = "Ouch, that hurt!",
Disappointed = "Back to the drawing board..",
Angry = "Now you've done it."
}
enum StatusFlags {
Poisoned = 1,
Frozen = 2,
Stunned = 4,
Confused = 8,
Enraged = 16
}