-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
[Ll]ibrary/ | ||
[Tt]emp/ | ||
[Oo]bj/ | ||
[Bb]uild/ | ||
[Bb]uilds/ | ||
Assets/AssetStoreTools* | ||
|
||
# Visual Studio cache directory | ||
.vs/ | ||
|
||
# Autogenerated VS/MD/Consulo solution and project files | ||
ExportedObj/ | ||
.consulo/ | ||
*.csproj | ||
*.unityproj | ||
*.sln | ||
*.suo | ||
*.tmp | ||
*.user | ||
*.userprefs | ||
*.pidb | ||
*.booproj | ||
*.svd | ||
*.pdb | ||
*.opendb | ||
|
||
# Unity3D generated meta files | ||
*.pidb.meta | ||
*.pdb.meta | ||
|
||
# Unity3D Generated File On Crash Reports | ||
sysinfo.txt | ||
|
||
# Builds | ||
*.apk | ||
*.unitypackage | ||
.idea/ |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
%YAML 1.1 | ||
%TAG !u! tag:unity3d.com,2011: | ||
--- !u!114 &11400000 | ||
MonoBehaviour: | ||
m_ObjectHideFlags: 0 | ||
m_CorrespondingSourceObject: {fileID: 0} | ||
m_PrefabInstance: {fileID: 0} | ||
m_PrefabAsset: {fileID: 0} | ||
m_GameObject: {fileID: 0} | ||
m_Enabled: 1 | ||
m_EditorHideFlags: 0 | ||
m_Script: {fileID: 11500000, guid: 16d40f4c171d6f647a7e84fcaaf26327, type: 3} | ||
m_Name: CodegenExecutor | ||
m_EditorClassIdentifier: | ||
OutputPath: Sources/Generated |
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,124 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGeneration.Plugins.ContextsGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
public partial class Contexts : Entitas.IContexts { | ||
|
||
public static Contexts sharedInstance { | ||
get { | ||
if (_sharedInstance == null) { | ||
_sharedInstance = new Contexts(); | ||
} | ||
|
||
return _sharedInstance; | ||
} | ||
set { _sharedInstance = value; } | ||
} | ||
|
||
static Contexts _sharedInstance; | ||
|
||
public GameContext game { get; set; } | ||
|
||
public Entitas.IContext[] allContexts { get { return new Entitas.IContext [] { game }; } } | ||
|
||
public Contexts() { | ||
game = new GameContext(); | ||
|
||
var postConstructors = System.Linq.Enumerable.Where( | ||
GetType().GetMethods(), | ||
method => System.Attribute.IsDefined(method, typeof(Entitas.CodeGeneration.Attributes.PostConstructorAttribute)) | ||
); | ||
|
||
foreach (var postConstructor in postConstructors) { | ||
postConstructor.Invoke(this, null); | ||
} | ||
} | ||
|
||
public void Reset() { | ||
var contexts = allContexts; | ||
for (int i = 0; i < contexts.Length; i++) { | ||
contexts[i].Reset(); | ||
} | ||
} | ||
} | ||
|
||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGeneration.Plugins.EntityIndexGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
public partial class Contexts { | ||
|
||
public const string Connection = "Connection"; | ||
public const string ControlledBy = "ControlledBy"; | ||
public const string Id = "Id"; | ||
|
||
[Entitas.CodeGeneration.Attributes.PostConstructor] | ||
public void InitializeEntityIndices() { | ||
game.AddEntityIndex(new Entitas.PrimaryEntityIndex<GameEntity, ushort>( | ||
Connection, | ||
game.GetGroup(GameMatcher.Connection), | ||
(e, c) => ((Connection)c).Id)); | ||
|
||
game.AddEntityIndex(new Entitas.PrimaryEntityIndex<GameEntity, ushort>( | ||
ControlledBy, | ||
game.GetGroup(GameMatcher.ControlledBy), | ||
(e, c) => ((ControlledBy)c).Value)); | ||
|
||
game.AddEntityIndex(new Entitas.PrimaryEntityIndex<GameEntity, ushort>( | ||
Id, | ||
game.GetGroup(GameMatcher.Id), | ||
(e, c) => ((IdComponent)c).Value)); | ||
} | ||
} | ||
|
||
public static class ContextsExtensions { | ||
|
||
public static GameEntity GetEntityWithConnection(this GameContext context, ushort Id) { | ||
return ((Entitas.PrimaryEntityIndex<GameEntity, ushort>)context.GetEntityIndex(Contexts.Connection)).GetEntity(Id); | ||
} | ||
|
||
public static GameEntity GetEntityWithControlledBy(this GameContext context, ushort Value) { | ||
return ((Entitas.PrimaryEntityIndex<GameEntity, ushort>)context.GetEntityIndex(Contexts.ControlledBy)).GetEntity(Value); | ||
} | ||
|
||
public static GameEntity GetEntityWithId(this GameContext context, ushort Value) { | ||
return ((Entitas.PrimaryEntityIndex<GameEntity, ushort>)context.GetEntityIndex(Contexts.Id)).GetEntity(Value); | ||
} | ||
} | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.VisualDebugging.CodeGeneration.Plugins.ContextObserverGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
public partial class Contexts { | ||
|
||
#if (!ENTITAS_DISABLE_VISUAL_DEBUGGING && UNITY_EDITOR) | ||
|
||
[Entitas.CodeGeneration.Attributes.PostConstructor] | ||
public void InitializeContextObservers() { | ||
try { | ||
CreateContextObserver(game); | ||
} catch(System.Exception) { | ||
} | ||
} | ||
|
||
public void CreateContextObserver(Entitas.IContext context) { | ||
if (UnityEngine.Application.isPlaying) { | ||
var observer = new Entitas.VisualDebugging.Unity.ContextObserver(context); | ||
UnityEngine.Object.DontDestroyOnLoad(observer.gameObject); | ||
} | ||
} | ||
|
||
#endif | ||
} |
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.
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,12 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGeneration.Plugins.EventListenerComponentGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
[Entitas.CodeGeneration.Attributes.DontGenerate(false)] | ||
public sealed class DestroyedListenerComponent : Entitas.IComponent { | ||
public System.Collections.Generic.List<IDestroyedListener> value; | ||
} |
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,14 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGeneration.Plugins.EventSystemsGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
public sealed class GameEventSystems : Feature { | ||
|
||
public GameEventSystems(Contexts contexts) { | ||
Add(new DestroyedEventSystem(contexts)); // priority: 0 | ||
} | ||
} |
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,11 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGeneration.Plugins.EventListenertInterfaceGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
public interface IDestroyedListener { | ||
void OnDestroyed(GameEntity entity); | ||
} |
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 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by Entitas.CodeGeneration.Plugins.EventSystemGenerator. | ||
// | ||
// Changes to this file may cause incorrect behavior and will be lost if | ||
// the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
public sealed class DestroyedEventSystem : Entitas.ReactiveSystem<GameEntity> { | ||
|
||
readonly System.Collections.Generic.List<IDestroyedListener> _listenerBuffer; | ||
|
||
public DestroyedEventSystem(Contexts contexts) : base(contexts.game) { | ||
_listenerBuffer = new System.Collections.Generic.List<IDestroyedListener>(); | ||
} | ||
|
||
protected override Entitas.ICollector<GameEntity> GetTrigger(Entitas.IContext<GameEntity> context) { | ||
return Entitas.CollectorContextExtension.CreateCollector( | ||
context, Entitas.TriggerOnEventMatcherExtension.Added(GameMatcher.Destroyed) | ||
); | ||
} | ||
|
||
protected override bool Filter(GameEntity entity) { | ||
return entity.isDestroyed && entity.hasDestroyedListener; | ||
} | ||
|
||
protected override void Execute(System.Collections.Generic.List<GameEntity> entities) { | ||
foreach (var e in entities) { | ||
|
||
_listenerBuffer.Clear(); | ||
_listenerBuffer.AddRange(e.destroyedListener.value); | ||
foreach (var listener in _listenerBuffer) { | ||
listener.OnDestroyed(e); | ||
} | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.