-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
- Loading branch information
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
using System; | ||
|
||
namespace Extensions | ||
{ | ||
public static class BitExtensions | ||
{ | ||
public static byte SetBit(this byte b, int field, bool value) | ||
{ | ||
if (value) //set value | ||
b = (byte)(b | field); | ||
else //clear value | ||
b = (byte)(b & (~field)); | ||
|
||
return b; | ||
} | ||
|
||
public static bool HasBits(this byte b, int field) | ||
{ | ||
return (b & field) > 0; | ||
} | ||
|
||
public static bool TryParse<TEnum>(string value, out TEnum result) where TEnum : struct, IConvertible | ||
{ | ||
var retValue = value == null ? false : Enum.IsDefined(typeof(TEnum), value); | ||
result = retValue ? (TEnum)Enum.Parse(typeof(TEnum), value) : default(TEnum); | ||
return retValue; | ||
} | ||
|
||
public static int PopCount(this byte b) | ||
{ | ||
int i = b; | ||
i = i - ((i >> 1) & 0x55555555); | ||
i = (i & 0x33333333) + ((i >> 2) & 0x33333333); | ||
return (((i + (i >> 4)) & 0x0F0F0F0F) * 0x01010101) >> 24; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGenerator.PoolAttributesGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
using Entitas.CodeGenerator; | ||
|
||
public class GameAttribute : PoolAttribute { | ||
public GameAttribute() : base("Game") { | ||
} | ||
} | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGenerator.ComponentIndicesGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
public static class GameComponentIds { | ||
public const int InScene = 0; | ||
public const int Level = 1; | ||
public const int LevelData = 2; | ||
public const int Piece = 3; | ||
public const int PieceApplyRotation = 4; | ||
public const int PieceBottomDots = 5; | ||
public const int PieceBounds = 6; | ||
public const int PieceRotation = 7; | ||
public const int Position = 8; | ||
public const int Rotation = 9; | ||
|
||
public const int TotalComponents = 10; | ||
|
||
public static readonly string[] componentNames = { | ||
"InScene", | ||
"Level", | ||
"LevelData", | ||
"Piece", | ||
"PieceApplyRotation", | ||
"PieceBottomDots", | ||
"PieceBounds", | ||
"PieceRotation", | ||
"Position", | ||
"Rotation" | ||
}; | ||
|
||
public static readonly System.Type[] componentTypes = { | ||
typeof(ShapeTetris.Components.InScene), | ||
typeof(ShapeTetris.Components.Level), | ||
typeof(ShapeTetris.Components.LevelData), | ||
typeof(ShapeTetris.Components.Piece), | ||
typeof(ShapeTetris.Components.PieceApplyRotation), | ||
typeof(ShapeTetris.Components.PieceBottomDots), | ||
typeof(ShapeTetris.Components.PieceBounds), | ||
typeof(ShapeTetris.Components.PieceRotation), | ||
typeof(ShapeTetris.Components.Position), | ||
typeof(ShapeTetris.Components.Rotation) | ||
}; | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGenerator.PoolsGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
using Entitas; | ||
|
||
public static class Pools { | ||
|
||
static Pool[] _allPools; | ||
|
||
public static Pool[] allPools { | ||
get { | ||
if (_allPools == null) { | ||
_allPools = new [] { game, system }; | ||
} | ||
|
||
return _allPools; | ||
} | ||
} | ||
|
||
static Pool _game; | ||
|
||
public static Pool game { | ||
get { | ||
if (_game == null) { | ||
_game = new Pool(GameComponentIds.TotalComponents, 0, new PoolMetaData("Game Pool", GameComponentIds.componentNames, GameComponentIds.componentTypes)); | ||
#if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR) | ||
if (UnityEngine.Application.isPlaying) { | ||
var poolObserver = new Entitas.Unity.VisualDebugging.PoolObserver(_game); | ||
UnityEngine.Object.DontDestroyOnLoad(poolObserver.entitiesContainer); | ||
} | ||
#endif | ||
} | ||
|
||
return _game; | ||
} | ||
} | ||
|
||
static Pool _system; | ||
|
||
public static Pool system { | ||
get { | ||
if (_system == null) { | ||
_system = new Pool(SystemComponentIds.TotalComponents, 0, new PoolMetaData("System Pool", SystemComponentIds.componentNames, SystemComponentIds.componentTypes)); | ||
#if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR) | ||
if (UnityEngine.Application.isPlaying) { | ||
var poolObserver = new Entitas.Unity.VisualDebugging.PoolObserver(_system); | ||
UnityEngine.Object.DontDestroyOnLoad(poolObserver.entitiesContainer); | ||
} | ||
#endif | ||
} | ||
|
||
return _system; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGenerator.ComponentExtensionsGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
using Entitas; | ||
|
||
namespace Entitas { | ||
public partial class Entity { | ||
public ShapeTetris.Components.InScene inScene { get { return (ShapeTetris.Components.InScene)GetComponent(GameComponentIds.InScene); } } | ||
|
||
public bool hasInScene { get { return HasComponent(GameComponentIds.InScene); } } | ||
|
||
public Entity AddInScene(UnityEngine.GameObject newObject) { | ||
var component = CreateComponent<ShapeTetris.Components.InScene>(GameComponentIds.InScene); | ||
component.Object = newObject; | ||
return AddComponent(GameComponentIds.InScene, component); | ||
} | ||
|
||
public Entity ReplaceInScene(UnityEngine.GameObject newObject) { | ||
var component = CreateComponent<ShapeTetris.Components.InScene>(GameComponentIds.InScene); | ||
component.Object = newObject; | ||
ReplaceComponent(GameComponentIds.InScene, component); | ||
return this; | ||
} | ||
|
||
public Entity RemoveInScene() { | ||
return RemoveComponent(GameComponentIds.InScene); | ||
} | ||
} | ||
} | ||
|
||
public partial class GameMatcher { | ||
static IMatcher _matcherInScene; | ||
|
||
public static IMatcher InScene { | ||
get { | ||
if (_matcherInScene == null) { | ||
var matcher = (Matcher)Matcher.AllOf(GameComponentIds.InScene); | ||
matcher.componentNames = GameComponentIds.componentNames; | ||
_matcherInScene = matcher; | ||
} | ||
|
||
return _matcherInScene; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGenerator.ComponentExtensionsGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
using Entitas; | ||
|
||
namespace Entitas { | ||
public partial class Entity { | ||
public ShapeTetris.Components.LevelData levelData { get { return (ShapeTetris.Components.LevelData)GetComponent(GameComponentIds.LevelData); } } | ||
|
||
public bool hasLevelData { get { return HasComponent(GameComponentIds.LevelData); } } | ||
|
||
public Entity AddLevelData(ShapeTetris.Models.Dot[] newDots) { | ||
var component = CreateComponent<ShapeTetris.Components.LevelData>(GameComponentIds.LevelData); | ||
component.Dots = newDots; | ||
return AddComponent(GameComponentIds.LevelData, component); | ||
} | ||
|
||
public Entity ReplaceLevelData(ShapeTetris.Models.Dot[] newDots) { | ||
var component = CreateComponent<ShapeTetris.Components.LevelData>(GameComponentIds.LevelData); | ||
component.Dots = newDots; | ||
ReplaceComponent(GameComponentIds.LevelData, component); | ||
return this; | ||
} | ||
|
||
public Entity RemoveLevelData() { | ||
return RemoveComponent(GameComponentIds.LevelData); | ||
} | ||
} | ||
} | ||
|
||
public partial class GameMatcher { | ||
static IMatcher _matcherLevelData; | ||
|
||
public static IMatcher LevelData { | ||
get { | ||
if (_matcherLevelData == null) { | ||
var matcher = (Matcher)Matcher.AllOf(GameComponentIds.LevelData); | ||
matcher.componentNames = GameComponentIds.componentNames; | ||
_matcherLevelData = matcher; | ||
} | ||
|
||
return _matcherLevelData; | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.