Mirror of Svelto.ECS because we're a fan of it
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
|
- namespace Svelto.ECS
- {
- /// <summary>
- /// Exclusive Groups guarantee that the GroupID is unique.
- ///
- /// The best way to use it is like:
- ///
- /// public static class MyExclusiveGroups //(can be as many as you want)
- /// {
- /// public static MyExclusiveGroup1 = new ExclusiveGroup();
- /// }
- /// </summary>
-
- public class ExclusiveGroup
- {
- public ExclusiveGroup()
- {
- _id = _globalId;
- _globalId += 1;
- }
-
- /// <summary>
- /// Use this constructor to reserve N groups
- /// </summary>
- public ExclusiveGroup(int range)
- {
- _id = _globalId;
- _globalId += range;
- }
-
- public static explicit operator int(ExclusiveGroup group) // explicit byte to digit conversion operator
- {
- return group._id;
- }
-
- readonly int _id;
- static int _globalId;
- }
- }
|