|
Is it possible to use Bitwise operations to be used as flags instead of using boolean algebra for testing? I cannot find a source (C# textbook) that even discusses it. What C# text would be excellent for using with Unity? Thanks CSDG
(comments are locked)
|
|
The bitwise operators are &, |, ^ for AND, OR and XOR (the logic operators are && and ||). You can find a more complete reference in: To use bitwise operators in logic decisions you should compare the result to 0: if ((flag1 & flag2)!=0){ ... }
May 26 '11 at 09:24 PM
aldonaletto
The problem when using a classic Finite State Machine is that only one state can be called at a time. So testing for these simultaneous operations algebraically would be a mess. If I could simply "OR" the stated bits that would give me the desired effect without the boolean mess. Setting up a switch to cycle through the states for example ATTACK and FIRE while both keys are pressed simultaneously. Thanks for the info CSDG
May 26 '11 at 09:36 PM
UniteMage
(comments are locked)
|
|
I have it working - I cleared out extra states that were redundant. Thanks Again CSDG
(comments are locked)
|
