Hi,
I wanna setup a simple Role System. So I made a ERole Enumeration with the Bitmask Flag set!
Now in my PlayerController I have an Integer with the Bitmask Enumeration applied. So I can give the PlayerController several roles…
Currently the following Roles exists: Player, Guard, Moderator, Admin
The reason I want it to be a bit mask is, because Player can have multiple roles. An admin is also a player etc…
Now I have Interactables in the game and I dont want everyone to have access to those interactables. I only want people with certain roles to have access.
So my Interactable has an Integer with the Bitmask Enumeration applied too which I called “Required Roles”.
Now I need to make sure that, exact the PlayerController’s Roles (bits that are set) are ALSO set in the Required Roles Integer. However, the Player Controller should be able to have more roles than required, but he must have the one’s defined in the Required Roles.
So how would I achieve that? I never worked with Bitmasks before? But I understood that when I compare only the Integer values with each other that the Player Controller can only have the exact same roles that are defined in the Required Roles! So how would I do that?
Thanks in advance.