|
Post by Freddie on Oct 11, 2018 17:05:36 GMT
Hello I read through your article and had a question how i would reference the bitmasks int value to cast it to a zone
for instance
[Flags]
public enum dmgType {
None = 0, Attack= 1 << 0,
Spell= 1 << 1,
Direct = 1 << 2
}
the value might be equal to 2 lets say and i want it to direct dmg
int value = object.dmgTypeInt; dmgType dmgtype= (dmgType)value;
debug.log (dmgtype); should output Direct
|
|
|
Post by Freddie on Oct 11, 2018 17:45:05 GMT
Okay i understood bitwise shifting incorrectly - - the bits ar shifted to the left however many times the int value to the right
so attack = 1 spell equal 10 and direct equal 100 - binary or 1 , 2 and 4 respectively - in decimal - hope this helps anyone else that wanders on these forums
|
|
|
Post by Admin on Oct 14, 2018 21:02:43 GMT
|
|