├── .editorconfig
├── .github
├── ISSUE_TEMPLATE
│ ├── bug_report.md
│ ├── feature_request.md
│ └── question.md
└── workflows
│ ├── build.yml
│ ├── ci.yml
│ └── release.yml
├── .gitignore
├── .gitmodules
├── .sln.dotsettings
├── .gitignore
├── CodeStyle.DotSettings
├── InspectionSettings.DotSettings
└── PatternsAndTemplates.DotSettings
├── CHANGELOG.md
├── CONTRIBUTING.md
├── Directory.Build.props
├── Directory.Build.targets
├── Entitas.sln
├── Entitas.sln.DotSettings
├── EntitasUpgradeGuide.md
├── LICENSE.md
├── README.md
├── Unity3D.props
├── benchmarks
└── Entitas.Benchmarks
│ ├── AERCBenchmarks.cs
│ ├── CreateComponentBenchmarks.cs
│ ├── DelegateBenchmarks.cs
│ ├── Entitas.Benchmarks.csproj
│ └── Program.cs
├── gen
└── Entitas.Generators
│ ├── Component
│ ├── ComponentDeclaration.cs
│ ├── ComponentGenerator.CleanupSystem.cs
│ ├── ComponentGenerator.CleanupSystems.cs
│ ├── ComponentGenerator.ComponentIndex.cs
│ ├── ComponentGenerator.ContextExtension.cs
│ ├── ComponentGenerator.ContextInitializationMethod.cs
│ ├── ComponentGenerator.EntityExtension.cs
│ ├── ComponentGenerator.EntityIndexExtension.cs
│ ├── ComponentGenerator.EventSystems.cs
│ ├── ComponentGenerator.Events.cs
│ ├── ComponentGenerator.Matcher.cs
│ ├── ComponentGenerator.cs
│ ├── ContextInitializationMethodDeclaration.cs
│ ├── EventDeclaration.cs
│ └── MemberDeclaration.cs
│ ├── Context
│ ├── ContextDeclaration.cs
│ ├── ContextGenerator.ComponentIndex.cs
│ ├── ContextGenerator.Context.cs
│ ├── ContextGenerator.Entity.cs
│ ├── ContextGenerator.Matcher.cs
│ └── ContextGenerator.cs
│ ├── Entitas.Generators.csproj
│ ├── Entitas.Generators.csproj.DotSettings
│ ├── EntitasAnalyzerConfigOptions.cs
│ └── Templates.cs
├── icon.png
├── images
├── Entitas-Game-Architecture.jpeg
├── Entitas-Header-Dark.png
├── Entitas-Header.png
├── Entitas-Shmup.png
├── Entitas.Unity-MenuItems.png
├── Entitas.Unity.VisualDebugging-ContextObserver.png
├── Entitas.Unity.VisualDebugging-DebugSystems.png
├── Entitas.Unity.VisualDebugging-Entity-MultiTarget.png
├── Entitas.Unity.VisualDebugging-Entity.png
├── Entitas.Unity.VisualDebugging-Hierarchy.png
├── Entitas.Unity.VisualDebugging-Preferences.png
└── madeWithEntitas.png
├── samples
└── Unity
│ ├── .editorconfig
│ ├── Assets
│ ├── Plugins.meta
│ ├── Sample.meta
│ └── Sample
│ │ ├── Editor.meta
│ │ ├── Editor
│ │ ├── CustomObjectDrawer.cs
│ │ ├── CustomObjectDrawer.cs.meta
│ │ ├── PersonComponentDrawer.cs
│ │ └── PersonComponentDrawer.cs.meta
│ │ ├── Runtime.meta
│ │ ├── Runtime
│ │ ├── Components Scene.unity
│ │ ├── Components Scene.unity.meta
│ │ ├── Components.meta
│ │ ├── Components
│ │ │ ├── MyArray2DComponent.cs
│ │ │ ├── MyArray2DComponent.cs.meta
│ │ │ ├── MyArray3DComponent.cs
│ │ │ ├── MyArray3DComponent.cs.meta
│ │ │ ├── MyArrayComponent.cs
│ │ │ ├── MyArrayComponent.cs.meta
│ │ │ ├── MyCharComponent.cs
│ │ │ ├── MyCharComponent.cs.meta
│ │ │ ├── MyCustomObjectComponent.cs
│ │ │ ├── MyCustomObjectComponent.cs.meta
│ │ │ ├── MyDateTimeComponent.cs
│ │ │ ├── MyDateTimeComponent.cs.meta
│ │ │ ├── MyDictArrayComponent.cs
│ │ │ ├── MyDictArrayComponent.cs.meta
│ │ │ ├── MyDictionaryComponent.cs
│ │ │ ├── MyDictionaryComponent.cs.meta
│ │ │ ├── MyDontDrawComponent.cs
│ │ │ ├── MyDontDrawComponent.cs.meta
│ │ │ ├── MyFlagComponent.cs
│ │ │ ├── MyFlagComponent.cs.meta
│ │ │ ├── MyHashSetComponent.cs
│ │ │ ├── MyHashSetComponent.cs.meta
│ │ │ ├── MyJaggedArrayComponent.cs
│ │ │ ├── MyJaggedArrayComponent.cs.meta
│ │ │ ├── MyListArrayComponent.cs
│ │ │ ├── MyListArrayComponent.cs.meta
│ │ │ ├── MyListComponent.cs
│ │ │ ├── MyListComponent.cs.meta
│ │ │ ├── MyMemberListComponent.cs
│ │ │ ├── MyMemberListComponent.cs.meta
│ │ │ ├── MyMonoBehaviourSubClassComponent.cs
│ │ │ ├── MyMonoBehaviourSubClassComponent.cs.meta
│ │ │ ├── MyPersonComponent.cs
│ │ │ ├── MyPersonComponent.cs.meta
│ │ │ ├── MyPropertyComponent.cs
│ │ │ ├── MyPropertyComponent.cs.meta
│ │ │ ├── MySimpleObjectComponent.cs
│ │ │ ├── MySimpleObjectComponent.cs.meta
│ │ │ ├── MySystemObjectComponent.cs
│ │ │ ├── MySystemObjectComponent.cs.meta
│ │ │ ├── MyUniqueComponent.cs
│ │ │ ├── MyUniqueComponent.cs.meta
│ │ │ ├── MyUnsupportedObjectComponent.cs
│ │ │ ├── MyUnsupportedObjectComponent.cs.meta
│ │ │ ├── UnityBuiltInTypes.meta
│ │ │ └── UnityBuiltInTypes
│ │ │ │ ├── MyAnimationCurveComponent.cs
│ │ │ │ ├── MyAnimationCurveComponent.cs.meta
│ │ │ │ ├── MyBoolComponent.cs
│ │ │ │ ├── MyBoolComponent.cs.meta
│ │ │ │ ├── MyBoundsComponent.cs
│ │ │ │ ├── MyBoundsComponent.cs.meta
│ │ │ │ ├── MyColorComponent.cs
│ │ │ │ ├── MyColorComponent.cs.meta
│ │ │ │ ├── MyDoubleComponent.cs
│ │ │ │ ├── MyDoubleComponent.cs.meta
│ │ │ │ ├── MyEnumComponent.cs
│ │ │ │ ├── MyEnumComponent.cs.meta
│ │ │ │ ├── MyFlagsComponent.cs
│ │ │ │ ├── MyFlagsComponent.cs.meta
│ │ │ │ ├── MyFloatComponent.cs
│ │ │ │ ├── MyFloatComponent.cs.meta
│ │ │ │ ├── MyGameObjectComponent.cs
│ │ │ │ ├── MyGameObjectComponent.cs.meta
│ │ │ │ ├── MyIntComponent.cs
│ │ │ │ ├── MyIntComponent.cs.meta
│ │ │ │ ├── MyRectComponent.cs
│ │ │ │ ├── MyRectComponent.cs.meta
│ │ │ │ ├── MyStringComponent.cs
│ │ │ │ ├── MyStringComponent.cs.meta
│ │ │ │ ├── MyTexture2DComponent.cs
│ │ │ │ ├── MyTexture2DComponent.cs.meta
│ │ │ │ ├── MyTextureComponent.cs
│ │ │ │ ├── MyTextureComponent.cs.meta
│ │ │ │ ├── MyUnityObjectComponent.cs
│ │ │ │ ├── MyUnityObjectComponent.cs.meta
│ │ │ │ ├── MyVector2Component.cs
│ │ │ │ ├── MyVector2Component.cs.meta
│ │ │ │ ├── MyVector3Component.cs
│ │ │ │ ├── MyVector3Component.cs.meta
│ │ │ │ ├── MyVector4Component.cs
│ │ │ │ └── MyVector4Component.cs.meta
│ │ ├── ComponentsController.cs
│ │ ├── ComponentsController.cs.meta
│ │ ├── Contexts.meta
│ │ ├── Contexts
│ │ │ ├── ContextInitialization.cs
│ │ │ ├── ContextInitialization.cs.meta
│ │ │ ├── GameContext.cs
│ │ │ ├── GameContext.cs.meta
│ │ │ ├── InputContext.cs
│ │ │ └── InputContext.cs.meta
│ │ ├── Systems Scene.unity
│ │ ├── Systems Scene.unity.meta
│ │ ├── Systems.meta
│ │ ├── Systems
│ │ │ ├── AReactiveSystem.cs
│ │ │ ├── AReactiveSystem.cs.meta
│ │ │ ├── CleanupSystem.cs
│ │ │ ├── CleanupSystem.cs.meta
│ │ │ ├── FastSystem.cs
│ │ │ ├── FastSystem.cs.meta
│ │ │ ├── MixedSystem.cs
│ │ │ ├── MixedSystem.cs.meta
│ │ │ ├── ProcessRandomValueSystem.cs
│ │ │ ├── ProcessRandomValueSystem.cs.meta
│ │ │ ├── RandomDurationSystem.cs
│ │ │ ├── RandomDurationSystem.cs.meta
│ │ │ ├── RandomValueSystem.cs
│ │ │ ├── RandomValueSystem.cs.meta
│ │ │ ├── SlowInitializeExecuteSystem.cs
│ │ │ ├── SlowInitializeExecuteSystem.cs.meta
│ │ │ ├── SlowInitializeSystem.cs
│ │ │ ├── SlowInitializeSystem.cs.meta
│ │ │ ├── SlowSystem.cs
│ │ │ ├── SlowSystem.cs.meta
│ │ │ ├── SomeExecuteSystem.cs
│ │ │ ├── SomeExecuteSystem.cs.meta
│ │ │ ├── SomeInitializeExecuteSystem.cs
│ │ │ ├── SomeInitializeExecuteSystem.cs.meta
│ │ │ ├── SomeInitializeReactiveSystem.cs
│ │ │ ├── SomeInitializeReactiveSystem.cs.meta
│ │ │ ├── SomeInitializeSystem.cs
│ │ │ ├── SomeInitializeSystem.cs.meta
│ │ │ ├── SomeReactiveSystem.cs
│ │ │ ├── SomeReactiveSystem.cs.meta
│ │ │ ├── TearDownSystem.cs
│ │ │ └── TearDownSystem.cs.meta
│ │ ├── SystemsController.cs
│ │ └── SystemsController.cs.meta
│ │ ├── Tests.meta
│ │ └── Tests
│ │ ├── Editor.meta
│ │ ├── Editor
│ │ ├── Tests.meta
│ │ └── Tests
│ │ │ ├── ContextTests.cs
│ │ │ ├── ContextTests.cs.meta
│ │ │ ├── EntityLinkTests.cs
│ │ │ └── EntityLinkTests.cs.meta
│ │ ├── Manual Tests.meta
│ │ └── Manual Tests
│ │ ├── Collector Destructor.meta
│ │ ├── Collector Destructor
│ │ ├── Collector Destructor.unity
│ │ ├── Collector Destructor.unity.meta
│ │ ├── CollectorDestructorController.cs
│ │ └── CollectorDestructorController.cs.meta
│ │ ├── Entity Stress Test.meta
│ │ ├── Entity Stress Test
│ │ ├── Entity Stress Test Scene.unity
│ │ ├── Entity Stress Test Scene.unity.meta
│ │ ├── EntityStressTestController.cs
│ │ └── EntityStressTestController.cs.meta
│ │ ├── EntityLink.meta
│ │ ├── EntityLink
│ │ ├── EntityLink Scene.unity
│ │ ├── EntityLink Scene.unity.meta
│ │ ├── EntityLinkController.cs
│ │ └── EntityLinkController.cs.meta
│ │ ├── Fixtures.meta
│ │ ├── Fixtures
│ │ ├── TestComponent.cs
│ │ ├── TestComponent.cs.meta
│ │ ├── TestReactiveSystem.cs
│ │ └── TestReactiveSystem.cs.meta
│ │ ├── Group Alloc.meta
│ │ ├── Group Alloc
│ │ ├── Group Alloc Scene.unity
│ │ ├── Group Alloc Scene.unity.meta
│ │ ├── GroupAllocController.cs
│ │ └── GroupAllocController.cs.meta
│ │ ├── Reactive System Exception.meta
│ │ ├── Reactive System Exception
│ │ ├── Reactive System Exception Scene.unity
│ │ ├── Reactive System Exception Scene.unity.meta
│ │ ├── ReactiveSystemExceptionController.cs
│ │ └── ReactiveSystemExceptionController.cs.meta
│ │ ├── ReactiveSystem Destructor.meta
│ │ └── ReactiveSystem Destructor
│ │ ├── ReactiveSystem Destructor.unity
│ │ ├── ReactiveSystem Destructor.unity.meta
│ │ ├── ReactiveSystemDestructorController.cs
│ │ └── ReactiveSystemDestructorController.cs.meta
│ ├── Entitas.properties
│ ├── Jenny.properties
│ ├── Packages
│ ├── manifest.json
│ └── packages-lock.json
│ ├── ProjectSettings
│ ├── AudioManager.asset
│ ├── ClusterInputManager.asset
│ ├── DynamicsManager.asset
│ ├── EditorBuildSettings.asset
│ ├── EditorSettings.asset
│ ├── GraphicsSettings.asset
│ ├── InputManager.asset
│ ├── MemorySettings.asset
│ ├── NavMeshAreas.asset
│ ├── PackageManagerSettings.asset
│ ├── Physics2DSettings.asset
│ ├── PresetManager.asset
│ ├── ProjectSettings.asset
│ ├── ProjectVersion.txt
│ ├── QualitySettings.asset
│ ├── TagManager.asset
│ ├── TimeManager.asset
│ ├── UnityConnectSettings.asset
│ ├── VFXManager.asset
│ ├── VersionControlSettings.asset
│ └── XRSettings.asset
│ └── restore_unity.bash
├── src
├── Entitas.Generators.Attributes
│ ├── CleanupAttribute.cs
│ ├── ContextAttribute.cs
│ ├── ContextInitializationAttribute.cs
│ ├── Entitas.Generators.Attributes.csproj
│ ├── EntityIndexAttribute.cs
│ ├── EventAttribute.cs
│ └── UniqueAttribute.cs
├── Entitas.Unity.Editor
│ ├── ContextObserverEditor.cs
│ ├── DebugSystemsEditor.cs
│ ├── DefaultInstanceCreator
│ │ ├── DefaultArrayCreator.cs
│ │ ├── DefaultStringCreator.cs
│ │ └── IDefaultInstanceCreator.cs
│ ├── Entitas.Unity.Editor.csproj
│ ├── Entitas.Unity.Editor.csproj.DotSettings
│ ├── EntitasHierarchyIcon.cs
│ ├── EntitasMenuItems.cs
│ ├── EntitasSettings.cs
│ ├── EntityDrawer.cs
│ ├── EntityDrawerState.cs
│ ├── EntityEditor.cs
│ ├── EntityLinkEditor.cs
│ ├── IComponentDrawer.cs
│ ├── Images
│ │ ├── EntitasContextErrorHierarchyIcon.png
│ │ ├── EntitasContextErrorHierarchyIcon.png.meta
│ │ ├── EntitasContextHierarchyIcon.png
│ │ ├── EntitasContextHierarchyIcon.png.meta
│ │ ├── EntitasEntityErrorHierarchyIcon.png
│ │ ├── EntitasEntityErrorHierarchyIcon.png.meta
│ │ ├── EntitasEntityHierarchyIcon.png
│ │ ├── EntitasEntityHierarchyIcon.png.meta
│ │ ├── EntitasEntityLinkHierarchyIcon.png
│ │ ├── EntitasEntityLinkHierarchyIcon.png.meta
│ │ ├── EntitasEntityLinkWarnHierarchyIcon.png
│ │ ├── EntitasEntityLinkWarnHierarchyIcon.png.meta
│ │ ├── EntitasHeader.png
│ │ ├── EntitasHeader.png.meta
│ │ ├── EntitasSystemsHierarchyIcon.png
│ │ ├── EntitasSystemsHierarchyIcon.png.meta
│ │ ├── EntitasSystemsWarnHierarchyIcon.png
│ │ └── EntitasSystemsWarnHierarchyIcon.png.meta
│ └── TypeDrawer
│ │ ├── AnimationCurveTypeDrawer.cs
│ │ ├── ArrayTypeDrawer.cs
│ │ ├── BoolTypeDrawer.cs
│ │ ├── BoundsTypeDrawer.cs
│ │ ├── CharTypeDrawer.cs
│ │ ├── ColorTypeDrawer.cs
│ │ ├── DateTimeTypeDrawer.cs
│ │ ├── DictionaryTypeDrawer.cs
│ │ ├── DoubleTypeDrawer.cs
│ │ ├── EnumTypeDrawer.cs
│ │ ├── FloatTypeDrawer.cs
│ │ ├── HashSetTypeDrawer.cs
│ │ ├── ITypeDrawer.cs
│ │ ├── IntTypeDrawer.cs
│ │ ├── ListTypeDrawer.cs
│ │ ├── RectTypeDrawer.cs
│ │ ├── StringTypeDrawer.cs
│ │ ├── UnityObjectTypeDrawer.cs
│ │ ├── Vector2TypeDrawer.cs
│ │ ├── Vector3TypeDrawer.cs
│ │ └── Vector4TypeDrawer.cs
├── Entitas.Unity
│ ├── ContextObserver
│ │ ├── ContextObserverBehaviour.cs
│ │ └── ContextObserverExtension.cs
│ ├── DebugSystems
│ │ ├── AvgResetInterval.cs
│ │ ├── DebugSystems.cs
│ │ ├── DebugSystemsBehaviour.cs
│ │ ├── Feature.cs
│ │ ├── SystemInfo.cs
│ │ └── SystemInterfaceFlags.cs
│ ├── Entitas.Unity.csproj
│ ├── Entitas.Unity.csproj.DotSettings
│ └── Entity
│ │ ├── DontDrawComponentAttribute.cs
│ │ ├── EntityBehaviour.cs
│ │ └── EntityLink.cs
└── Entitas
│ ├── Collector
│ ├── Collector.cs
│ ├── CollectorContextExtension.cs
│ ├── CollectorException.cs
│ ├── ICollector.cs
│ ├── TriggerOnEvent.cs
│ └── TriggerOnEventMatcherExtension.cs
│ ├── Context
│ ├── Context.cs
│ ├── ContextInfo.cs
│ ├── Exceptions
│ │ ├── ContextDoesNotContainEntityException.cs
│ │ ├── ContextEntityIndexDoesAlreadyExistException.cs
│ │ ├── ContextEntityIndexDoesNotExistException.cs
│ │ ├── ContextInfoException.cs
│ │ ├── ContextStillHasRetainedEntitiesException.cs
│ │ └── EntityIsNotDestroyedException.cs
│ └── IContext.cs
│ ├── Entitas.csproj
│ ├── Entitas.csproj.DotSettings
│ ├── EntitasException.cs
│ ├── Entity
│ ├── Entity.cs
│ ├── EntityEqualityComparer.cs
│ ├── Exceptions
│ │ ├── EntityAlreadyHasComponentException.cs
│ │ ├── EntityDoesNotHaveComponentException.cs
│ │ ├── EntityIsAlreadyRetainedByOwnerException.cs
│ │ ├── EntityIsNotEnabledException.cs
│ │ └── EntityIsNotRetainedByOwnerException.cs
│ ├── IAERC.cs
│ ├── SafeAERC.cs
│ └── UnsafeAERC.cs
│ ├── EntityIndex
│ ├── AbstractEntityIndex.cs
│ ├── EntityIndex.cs
│ ├── EntityIndexException.cs
│ ├── IEntityIndex.cs
│ └── PrimaryEntityIndex.cs
│ ├── Extensions
│ ├── CollectionExtension.cs
│ └── EntitasStringExtension.cs
│ ├── Group
│ ├── Group.cs
│ ├── GroupEvent.cs
│ ├── GroupExtension.cs
│ ├── GroupSingleEntityException.cs
│ └── IGroup.cs
│ ├── IComponent.cs
│ ├── Matcher
│ ├── Interfaces
│ │ ├── IAllOfMatcher.cs
│ │ ├── IAnyOfMatcher.cs
│ │ ├── ICompoundMatcher.cs
│ │ ├── IMatcher.cs
│ │ └── INoneOfMatcher.cs
│ ├── Matcher.cs
│ ├── MatcherEquals.cs
│ ├── MatcherException.cs
│ ├── MatcherStatic.cs
│ └── MatcherToString.cs
│ └── Systems
│ ├── Interfaces
│ ├── ICleanupSystem.cs
│ ├── IExecuteSystem.cs
│ ├── IInitializeSystem.cs
│ ├── IReactiveSystem.cs
│ ├── ISystem.cs
│ └── ITearDownSystem.cs
│ ├── ParallelSystem.cs
│ ├── ReactiveSystem.cs
│ └── Systems.cs
└── tests
├── Entitas.Generators.IntegrationTests
├── AnyFlagComponentAddedTests.cs
├── AnyFlagComponentRemovedTests.cs
├── CleanupSystemTests.cs
├── CleanupSystemsTests.cs
├── ComponentIndexTests.cs
├── ContextExtensionTests.cs
├── ContextInitialization.cs
├── ContextTests.cs
├── Entitas.Generators.IntegrationTests.csproj
├── EntityExtensionTests.cs
├── EntityIndexExtensionTests.cs
├── EntityIndexTests.cs
├── EntityTests.cs
├── EventSystemsTests.cs
├── FlagComponentAddedTests.cs
├── FlagComponentRemovedTests.cs
├── ListenerEventEntityExtensionTests.cs
├── MatcherTests.cs
└── fixtures
│ ├── EmptyContext.cs
│ ├── LoadingComponent.cs
│ ├── MainContext.cs
│ ├── OtherContext.cs
│ └── UserComponent.cs
├── Entitas.Generators.Tests.Fixtures.Dependencies
├── CollisionComponent.cs
├── ContextInitialization.cs
├── Entitas.Generators.Tests.Fixtures.Dependencies.csproj
├── HealthComponent.cs
├── LibraryContext.cs
└── MyApp.Library.Entity.cs
├── Entitas.Generators.Tests
├── ComponentGeneratorTests.cs
├── ContextGeneratorTests.cs
├── Entitas.Generators.Tests.csproj
├── ModuleInitializer.cs
├── TestHelper.cs
├── fixtures
│ ├── Components
│ │ ├── CleanupDestroyEntityComponent.cs
│ │ ├── CleanupDestroyEntityNamespacedComponent.cs
│ │ ├── CleanupRemoveComponent.cs
│ │ ├── CleanupRemoveNamespacedComponent.cs
│ │ ├── ComplexTypesComponent.cs
│ │ ├── ContextFromDifferentAssemblyNamespacedComponent.cs
│ │ ├── DuplicatedContextsNamespacedComponent.cs
│ │ ├── EntityIndexComponent.cs
│ │ ├── EntityIndexNamespacedComponent.cs
│ │ ├── EventComponent.cs
│ │ ├── EventNamespacedComponent.cs
│ │ ├── FlagEventComponent.cs
│ │ ├── FlagEventNamespacedComponent.cs
│ │ ├── MultipleFieldsComponent.cs
│ │ ├── MultipleFieldsNamespacedComponent.cs
│ │ ├── MultiplePropertiesNamespacedComponent.cs
│ │ ├── NoContextComponent.cs
│ │ ├── NoValidFieldsNamespacedComponent.cs
│ │ ├── NonPublicComponent.cs
│ │ ├── OneFieldComponent.cs
│ │ ├── OneFieldNamespacedComponent.cs
│ │ ├── PrimaryEntityIndexComponent.cs
│ │ ├── PrimaryEntityIndexNamespacedComponent.cs
│ │ ├── ReservedKeywordFieldsNamespacedComponent.cs
│ │ ├── SomeComponent.cs
│ │ ├── SomeNamespacedComponent.cs
│ │ ├── UniqueNamespacedComponent.cs
│ │ └── UniqueOneFieldNamespacedComponent.cs
│ ├── Contexts
│ │ ├── ContextInitialization.txt
│ │ ├── ContextInitializationFromDifferentAssembly.txt
│ │ ├── EmptyContextInitialization.txt
│ │ ├── NamespacedContext.txt
│ │ └── SomeContext.txt
│ ├── FakeGenerated
│ │ ├── ContextInitialization.cs
│ │ ├── MainContext.cs
│ │ └── MyApp.Main.Entity.cs
│ ├── SomeClass.cs
│ └── SomeNamespacedClass.cs
├── remove-snapshots.bash
├── snapshots-to-delete.txt
└── snapshots
│ ├── ComponentGeneratorTests.CleanupDestroyEntityComponent#DestroyMyAppMainCleanupDestroyEntityCleanupSystem.g.verified.cs
│ ├── ComponentGeneratorTests.CleanupDestroyEntityNamespacedComponent#MyFeature.DestroyMyAppMainCleanupDestroyEntityNamespacedCleanupSystem.g.verified.cs
│ ├── ComponentGeneratorTests.CleanupRemoveComponent#RemoveMyAppMainCleanupRemoveCleanupSystem.g.verified.cs
│ ├── ComponentGeneratorTests.CleanupRemoveNamespacedComponent#MyFeature.RemoveMyAppMainCleanupRemoveNamespacedCleanupSystem.g.verified.cs
│ ├── ComponentGeneratorTests.CleanupSystems#MyApp.MainContextCleanupSystemsExtension.g.verified.cs
│ ├── ComponentGeneratorTests.ComplexTypesComponent#MyFeature.MyAppMainComplexTypesEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.Component#MyAppMainSomeComponentIndex.g.verified.cs
│ ├── ComponentGeneratorTests.Component#MyAppMainSomeEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.Component#MyAppMainSomeMatcher.g.verified.cs
│ ├── ComponentGeneratorTests.ContextFromDifferentAssemblyNamespacedComponent#MyFeature.MyAppLibraryContextFromDifferentAssemblyNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.ContextInitialization#MyApp.ContextInitialization.Initialize.ContextInitialization.g.verified.cs
│ ├── ComponentGeneratorTests.ContextInitializationFromDifferentAssembly#MyApp.ContextInitialization.Initialize.ContextInitialization.g.verified.cs
│ ├── ComponentGeneratorTests.DuplicatedContextsNamespacedComponent#MyFeature.MyAppMainDuplicatedContextsNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.EmptyContextInitialization#MyApp.ContextInitialization.Initialize.ContextInitialization.g.verified.cs
│ ├── ComponentGeneratorTests.EntityIndexes#MyApp.MainContextEntityIndexExtension.g.verified.cs
│ ├── ComponentGeneratorTests.EventComponent#MyAppMainAnyEventAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventComponent#MyAppMainAnyEventRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventComponent#MyAppMainEventAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventComponent#MyAppMainEventRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventNamespacedComponent#MyFeature.MyAppMainAnyEventNamespacedAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventNamespacedComponent#MyFeature.MyAppMainAnyEventNamespacedRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventNamespacedComponent#MyFeature.MyAppMainEventNamespacedAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventNamespacedComponent#MyFeature.MyAppMainEventNamespacedRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.EventSystems#MyApp.MainContextEventSystemsExtension.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventComponent#MyAppMainAnyFlagEventAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventComponent#MyAppMainAnyFlagEventRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventComponent#MyAppMainFlagEventAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventComponent#MyAppMainFlagEventRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventNamespacedComponent#MyFeature.MyAppMainAnyFlagEventNamespacedAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventNamespacedComponent#MyFeature.MyAppMainAnyFlagEventNamespacedRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventNamespacedComponent#MyFeature.MyAppMainFlagEventNamespacedAddedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.FlagEventNamespacedComponent#MyFeature.MyAppMainFlagEventNamespacedRemovedListenerComponent.g.verified.cs
│ ├── ComponentGeneratorTests.MultipleFieldsComponent#MyAppMainMultipleFieldsEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.MultipleFieldsNamespacedComponent#MyFeature.MyAppMainMultipleFieldsNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.MultiplePropertiesNamespacedComponent#MyFeature.MyAppMainMultiplePropertiesNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.NamespacedComponent#MyFeature.MyAppMainSomeNamespacedComponentIndex.g.verified.cs
│ ├── ComponentGeneratorTests.NamespacedComponent#MyFeature.MyAppMainSomeNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.NamespacedComponent#MyFeature.MyAppMainSomeNamespacedMatcher.g.verified.cs
│ ├── ComponentGeneratorTests.NoCleanupSystems#EmptyContextCleanupSystemsExtension.g.verified.cs
│ ├── ComponentGeneratorTests.NoEntityIndexes#EmptyContextEntityIndexExtension.g.verified.cs
│ ├── ComponentGeneratorTests.NoEventSystems#EmptyContextEventSystemsExtension.g.verified.cs
│ ├── ComponentGeneratorTests.NoValidFieldsNamespacedComponent#MyFeature.MyAppMainNoValidFieldsNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.OneFieldComponent#MyAppMainOneFieldEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.OneFieldNamespacedComponent#MyFeature.MyAppMainOneFieldNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.ReservedKeywordFieldsNamespacedComponent#MyFeature.MyAppMainReservedKeywordFieldsNamespacedEntityExtension.g.verified.cs
│ ├── ComponentGeneratorTests.UniqueNamespacedComponent#MyFeature.MyAppMainUniqueNamespacedContextExtension.g.verified.cs
│ ├── ComponentGeneratorTests.UniqueOneFieldNamespacedComponent#MyFeature.MyAppMainUniqueOneFieldNamespacedContextExtension.g.verified.cs
│ ├── ContextGeneratorTests.NamespacedContext#MyApp.Namespaced.ComponentIndex.g.verified.cs
│ ├── ContextGeneratorTests.NamespacedContext#MyApp.Namespaced.Entity.g.verified.cs
│ ├── ContextGeneratorTests.NamespacedContext#MyApp.Namespaced.Matcher.g.verified.cs
│ ├── ContextGeneratorTests.NamespacedContext#MyApp.NamespacedContext.g.verified.cs
│ ├── ContextGeneratorTests.SomeContext#Some.ComponentIndex.g.verified.cs
│ ├── ContextGeneratorTests.SomeContext#Some.Entity.g.verified.cs
│ ├── ContextGeneratorTests.SomeContext#Some.Matcher.g.verified.cs
│ └── ContextGeneratorTests.SomeContext#SomeContext.g.verified.cs
├── Entitas.Tests
├── CollectorTests.cs
├── ContextInfoTests.cs
├── ContextTests.cs
├── Entitas.Tests.csproj
├── EntitasErrorMessagesTests.cs
├── EntitasExceptionTests.cs
├── EntitasStringExtension.cs
├── EntityIndexTests.cs
├── EntityTests.cs
├── GroupTests.cs
├── MatcherTests.cs
├── ParallelSystemTests.cs
├── PrimaryEntityIndexTests.cs
├── ReactiveSystemTests.cs
├── SystemsTests.cs
└── fixtures
│ ├── Components.cs
│ ├── Contexts.cs
│ ├── Systems
│ ├── CleanupSystemSpy.cs
│ ├── ExecuteSystemSpy.cs
│ ├── InitializeSystemSpy.cs
│ ├── ReactiveSystemSpy.cs
│ ├── TearDownSystemSpy.cs
│ └── TestParallelSystem.cs
│ └── UserComponent.cs
└── Entitas.Unity.Tests
├── Entitas.Unity.Tests.csproj
├── SystemInfoTests.cs
└── fixtures
├── TestCleanupSystem.cs
├── TestExecuteSystem.cs
├── TestInitializeSystem.cs
├── TestReactiveSystem.cs
└── TestTearDownSystem.cs
/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | indent_size = 4
7 | indent_style = space
8 | insert_final_newline = true
9 | tab_width = 4
10 | trim_trailing_whitespace = true
11 |
12 | [*.sln]
13 | indent_style = tab
14 |
15 | [*.csproj]
16 | indent_size = 2
17 | ij_xml_space_inside_empty_tag = true
18 |
19 | [*.DotSettings]
20 | indent_style = tab
21 | ij_xml_attribute_wrap = off
22 |
23 | [*.yml]
24 | indent_size = 2
25 |
26 | # [*.cs]
27 | # entitas_generator.component.cleanup_systems = false
28 | # entitas_generator.component.component_index = false
29 | # entitas_generator.component.context_extension = false
30 | # entitas_generator.component.context_initialization_method = false
31 | # entitas_generator.component.entity_extension = false
32 | # entitas_generator.component.entity_index_extension = false
33 | # entitas_generator.component.events = false
34 | # entitas_generator.component.event_systems_extension = false
35 | # entitas_generator.component.matcher = false
36 | #
37 | # entitas_generator.context.component_index = false
38 | # entitas_generator.context.context = false
39 | # entitas_generator.context.entity = false
40 | # entitas_generator.context.matcher = false
41 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/bug_report.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Bug report
3 | about: Create a report to help us improve
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Describe the bug**
11 | A clear and concise description of what the bug is.
12 |
13 | **To Reproduce**
14 | Steps to reproduce the behavior:
15 | 1. Go to '...'
16 | 2. Click on '....'
17 | 3. Scroll down to '....'
18 | 4. See error
19 |
20 | **Expected behavior**
21 | A clear and concise description of what you expected to happen.
22 |
23 | **Screenshots**
24 | If applicable, add screenshots to help explain your problem.
25 |
26 | **Additional context**
27 | Add any other context about the problem here.
28 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/feature_request.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Feature request
3 | about: Suggest an idea for this project
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Is your feature request related to a problem? Please describe.**
11 | A clear and concise description of what the problem is. Ex. I'm having issues when [...]
12 |
13 | **Describe the solution you'd like**
14 | A clear and concise description of what you want to happen.
15 |
16 | **Describe alternatives you've considered**
17 | A clear and concise description of any alternative solutions or features you've considered.
18 |
19 | **Additional context**
20 | Add any other context or screenshots about the feature request here.
21 |
--------------------------------------------------------------------------------
/.github/ISSUE_TEMPLATE/question.md:
--------------------------------------------------------------------------------
1 | ---
2 | name: Question
3 | about: Ask a question and get help from the community
4 | title: ''
5 | labels: ''
6 | assignees: ''
7 |
8 | ---
9 |
10 | **Ask a question**
11 | A clear and concise question. Ex. How to do xyz?
12 |
--------------------------------------------------------------------------------
/.github/workflows/ci.yml:
--------------------------------------------------------------------------------
1 | name: CI
2 |
3 | on:
4 | push:
5 | branches: [ main ]
6 | pull_request:
7 | branches: [ main ]
8 |
9 | jobs:
10 | build:
11 | uses: sschmid/Entitas/.github/workflows/build.yml@main
12 |
--------------------------------------------------------------------------------
/.github/workflows/release.yml:
--------------------------------------------------------------------------------
1 | name: Release
2 |
3 | on: workflow_dispatch
4 |
5 | jobs:
6 | build:
7 | uses: sschmid/Entitas/.github/workflows/build.yml@main
8 | release:
9 | needs: build
10 | runs-on: ubuntu-latest
11 | steps:
12 | - name: "Download packages"
13 | uses: actions/download-artifact@v3
14 | with:
15 | name: ${{ github.event.repository.name }} NuGet Packages
16 |
17 | - name: "Push to NuGet"
18 | run: |
19 | dotnet nuget push "*.nupkg" \
20 | --api-key ${{ secrets.NUGET_API_KEY }} \
21 | --skip-duplicate \
22 | --source https://api.nuget.org/v3/index.json
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OS
2 | .DS_Store
3 | Thumbs.db
4 |
5 | # Solution
6 | obj
7 | bin
8 | *.userprefs
9 | *.user
10 | TestResults
11 |
12 | # IDEs
13 | .idea
14 | .vs
15 | .vscode
16 | **/Assets/Plugins/Editor/JetBrains
17 | **/Assets/Plugins/Editor/JetBrains.meta
18 |
19 | # Unity
20 | Library
21 | Temp
22 | Logs
23 | UserSettings
24 | *.unitypackage
25 |
26 | # Custom
27 | *.userproperties
28 | build
29 | samples/Unity/.sln.dotsettings
30 | samples/Unity/*.sln*
31 | samples/Unity/*.csproj
32 | samples/Unity/Assets/Plugins
33 | samples/Unity/Assets/Generated
34 | coverage
35 | dist
36 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "unity/Unity-2021.3.0f1"]
2 | path = unity/Unity-2021.3.0f1
3 | url = https://github.com/sschmid/Unity-2021.3.0f1.git
4 |
--------------------------------------------------------------------------------
/.sln.dotsettings/.gitignore:
--------------------------------------------------------------------------------
1 | .DS_Store
2 | Thumbs.db
3 |
--------------------------------------------------------------------------------
/Directory.Build.targets:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Simon Schmid
5 | MIT
6 | icon.png
7 | https://github.com/sschmid/Entitas
8 | Entitas
9 | $(AssemblyName)
10 | Simon Schmid
11 | Entitas, ECS, Entity, Component, System, DesperateDevs, Desperate, Devs
12 | https://github.com/sschmid/Entitas
13 | git
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/LICENSE.md:
--------------------------------------------------------------------------------
1 | The MIT License
2 |
3 | Copyright (c) 2014 - 2023 Simon Schmid
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in
13 | all copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21 | THE SOFTWARE.
22 |
--------------------------------------------------------------------------------
/Unity3D.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | C:/Program Files
7 | Editor/Data/Managed
8 |
9 |
10 |
11 |
12 | /Applications
13 | Unity.app/Contents/Managed
14 |
15 |
16 |
17 |
18 | $([System.Environment]::GetFolderPath('System.Environment+SpecialFolder.UserProfile'))
19 | Editor/Data/Managed
20 |
21 |
22 |
23 |
24 |
25 | $(OSApplicationPath)/Unity/Hub/Editor
26 |
27 |
28 |
29 | $(UnityManagedPath)/UnityEngine.dll
30 | $(UnityManagedPath)/UnityEditor.dll
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/benchmarks/Entitas.Benchmarks/AERCBenchmarks.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using BenchmarkDotNet.Attributes;
4 | using BenchmarkDotNet.Order;
5 |
6 | // | Method | Mean | Error | StdDev | Rank | Allocated |
7 | // |----------- |----------:|----------:|----------:|-----:|----------:|
8 | // | UnsafeAERC | 1.153 ns | 0.0035 ns | 0.0033 ns | 1 | - |
9 | // | SafeAERC | 18.992 ns | 0.0751 ns | 0.0665 ns | 2 | - |
10 |
11 | namespace Entitas.Benchmarks
12 | {
13 | [MemoryDiagnoser]
14 | [Orderer(SummaryOrderPolicy.FastestToSlowest)]
15 | [RankColumn]
16 | public class AERCBenchmarks
17 | {
18 | SafeAERC _safeAerc;
19 | UnsafeAERC _unsafeAerc;
20 |
21 | [GlobalSetup]
22 | public void GlobalSetup()
23 | {
24 | _safeAerc = new SafeAERC(null);
25 | _unsafeAerc = new UnsafeAERC();
26 | }
27 |
28 | [Benchmark]
29 | public void SafeAERC()
30 | {
31 | _safeAerc.Retain(this);
32 | _safeAerc.Release(this);
33 | }
34 |
35 | [Benchmark]
36 | public void UnsafeAERC()
37 | {
38 | _unsafeAerc.Retain(this);
39 | _unsafeAerc.Release(this);
40 | }
41 | }
42 | }
43 |
--------------------------------------------------------------------------------
/benchmarks/Entitas.Benchmarks/Entitas.Benchmarks.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | Exe
5 | $(DefaultTestTargetFramework)
6 | enable
7 | false
8 | false
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/benchmarks/Entitas.Benchmarks/Program.cs:
--------------------------------------------------------------------------------
1 | using BenchmarkDotNet.Running;
2 | using Entitas.Benchmarks;
3 |
4 | // BenchmarkRunner.Run();
5 | // BenchmarkRunner.Run();
6 | BenchmarkRunner.Run();
7 |
--------------------------------------------------------------------------------
/gen/Entitas.Generators/Context/ContextDeclaration.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Microsoft.CodeAnalysis;
3 |
4 | namespace Entitas.Generators
5 | {
6 | public readonly struct ContextDeclaration : IEquatable
7 | {
8 | public readonly SyntaxTree SyntaxTree;
9 | public readonly string? Namespace;
10 | public readonly string FullName;
11 | public readonly string Name;
12 |
13 | public readonly string FullContextPrefix;
14 | public readonly string ContextPrefix;
15 |
16 | public ContextDeclaration(SyntaxTree syntaxTree, INamedTypeSymbol symbol)
17 | {
18 | SyntaxTree = syntaxTree;
19 | Namespace = !symbol.ContainingNamespace.IsGlobalNamespace ? symbol.ContainingNamespace.ToDisplayString() : null;
20 | FullName = symbol.ToDisplayString();
21 | Name = symbol.Name;
22 |
23 | FullContextPrefix = FullName.RemoveSuffix("Context");
24 | ContextPrefix = Name.RemoveSuffix("Context");
25 | }
26 |
27 | public bool Equals(ContextDeclaration other) => FullName == other.FullName;
28 | public override bool Equals(object? obj) => obj is ContextDeclaration other && Equals(other);
29 | public override int GetHashCode() => FullName.GetHashCode();
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/gen/Entitas.Generators/Context/ContextGenerator.Entity.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.CodeAnalysis;
2 | using Microsoft.CodeAnalysis.Diagnostics;
3 | using static Entitas.Generators.Templates;
4 |
5 | namespace Entitas.Generators
6 | {
7 | partial class ContextGenerator
8 | {
9 | static void Entity(SourceProductionContext spc, ContextDeclaration context, AnalyzerConfigOptionsProvider optionsProvider)
10 | {
11 | if (!EntitasAnalyzerConfigOptions.ContextEntity(optionsProvider, context.SyntaxTree))
12 | return;
13 |
14 | spc.AddSource(ContextAwarePath(context, "Entity"),
15 | GeneratedFileHeader(GeneratorSource(nameof(Entity))) +
16 | NamespaceDeclaration(context.FullContextPrefix,
17 | """
18 | public sealed class Entity : global::Entitas.Entity { }
19 |
20 | """));
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/gen/Entitas.Generators/Entitas.Generators.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultGeneratorFramework)
5 | 2.0.0
6 | enable
7 | true
8 |
9 |
10 |
11 |
12 | all
13 | runtime; build; native; contentfiles; analyzers; buildtransitive
14 |
15 |
16 |
17 |
18 |
19 |
--------------------------------------------------------------------------------
/gen/Entitas.Generators/Entitas.Generators.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 |
--------------------------------------------------------------------------------
/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/icon.png
--------------------------------------------------------------------------------
/images/Entitas-Game-Architecture.jpeg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas-Game-Architecture.jpeg
--------------------------------------------------------------------------------
/images/Entitas-Header-Dark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas-Header-Dark.png
--------------------------------------------------------------------------------
/images/Entitas-Header.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas-Header.png
--------------------------------------------------------------------------------
/images/Entitas-Shmup.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas-Shmup.png
--------------------------------------------------------------------------------
/images/Entitas.Unity-MenuItems.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas.Unity-MenuItems.png
--------------------------------------------------------------------------------
/images/Entitas.Unity.VisualDebugging-ContextObserver.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas.Unity.VisualDebugging-ContextObserver.png
--------------------------------------------------------------------------------
/images/Entitas.Unity.VisualDebugging-DebugSystems.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas.Unity.VisualDebugging-DebugSystems.png
--------------------------------------------------------------------------------
/images/Entitas.Unity.VisualDebugging-Entity-MultiTarget.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas.Unity.VisualDebugging-Entity-MultiTarget.png
--------------------------------------------------------------------------------
/images/Entitas.Unity.VisualDebugging-Entity.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas.Unity.VisualDebugging-Entity.png
--------------------------------------------------------------------------------
/images/Entitas.Unity.VisualDebugging-Hierarchy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas.Unity.VisualDebugging-Hierarchy.png
--------------------------------------------------------------------------------
/images/Entitas.Unity.VisualDebugging-Preferences.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/Entitas.Unity.VisualDebugging-Preferences.png
--------------------------------------------------------------------------------
/images/madeWithEntitas.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/images/madeWithEntitas.png
--------------------------------------------------------------------------------
/samples/Unity/.editorconfig:
--------------------------------------------------------------------------------
1 | root = true
2 |
3 | [*]
4 | charset = utf-8
5 | end_of_line = lf
6 | indent_size = 4
7 | indent_style = space
8 | insert_final_newline = true
9 | tab_width = 4
10 | trim_trailing_whitespace = true
11 |
12 | [*.sln]
13 | indent_style = tab
14 |
15 | [*.csproj]
16 | indent_size = 2
17 | ij_xml_space_inside_empty_tag = true
18 |
19 | [*.DotSettings]
20 | indent_style = tab
21 | ij_xml_attribute_wrap = off
22 |
23 | # [*.cs]
24 | # entitas_generator.component.cleanup_systems = false
25 | # entitas_generator.component.component_index = false
26 | # entitas_generator.component.context_extension = false
27 | # entitas_generator.component.context_initialization_method = false
28 | # entitas_generator.component.entity_extension = false
29 | # entitas_generator.component.entity_index_extension = false
30 | # entitas_generator.component.events = false
31 | # entitas_generator.component.event_systems_extension = false
32 | # entitas_generator.component.matcher = false
33 | #
34 | # entitas_generator.context.component_index = false
35 | # entitas_generator.context.context = false
36 | # entitas_generator.context.entity = false
37 | # entitas_generator.context.matcher = false
38 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Plugins.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2ce47528879ae462f9e00aef0ce4c26b
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d06c0160a13c94f329b85a954d6d6ce2
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d0d330747609f469d9222aaca8596864
3 | folderAsset: yes
4 | timeCreated: 1455739666
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Editor/CustomObjectDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Entitas.Unity.Editor;
3 | using UnityEditor;
4 |
5 | public class CustomObjectDrawer : ITypeDrawer, IDefaultInstanceCreator
6 | {
7 | public bool HandlesType(Type type) => type == typeof(MyCustomObject);
8 |
9 | public object CreateDefault(Type type) => new MyCustomObject("Default");
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target)
12 | {
13 | var myObject = (MyCustomObject)value;
14 | myObject.Name = EditorGUILayout.TextField(memberName, myObject.Name);
15 | return myObject;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Editor/CustomObjectDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f139ea7f89bfd430ca7ae4bdf876b48d
3 | timeCreated: 1487547487
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Editor/PersonComponentDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Entitas;
3 | using Entitas.Unity.Editor;
4 | using UnityEditor;
5 |
6 | public class PersonComponentDrawer : IComponentDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(MyPersonComponent);
9 |
10 | public IComponent DrawComponent(IComponent component)
11 | {
12 | var person = (MyPersonComponent)component;
13 | person.Name = EditorGUILayout.TextField("Name", person.Name);
14 | person.Gender ??= PersonGender.Male.ToString();
15 |
16 | var gender = (PersonGender)Enum.Parse(typeof(PersonGender), person.Gender);
17 | gender = (PersonGender)EditorGUILayout.EnumPopup("Gender", gender);
18 | person.Gender = gender.ToString();
19 |
20 | return person;
21 | }
22 |
23 | enum PersonGender
24 | {
25 | Male,
26 | Female
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Editor/PersonComponentDrawer.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: be7914664e5264280ac6c734caa48785
3 | timeCreated: 1460665985
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 48b3b593753ab4ac48e8623ed018ed73
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8646dd6b1da3a4568b60fe085252f2bf
3 | timeCreated: 1455739666
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 713b02e4749e4da889797530373f60e3
3 | timeCreated: 1667936307
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyArray2DComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyArray2DComponent : IComponent
6 | {
7 | public string[,] Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyArray2DComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: f31e6e9c6ad04f4b92f11a0a2e0ca9b6
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyArray3DComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyArray3DComponent : IComponent
6 | {
7 | public string[,,] Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyArray3DComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d616f6566f1f471cbbc373c057650786
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyArrayComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyArrayComponent : IComponent
6 | {
7 | public string[] Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyArrayComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a4fc4922dfd4d490db56d6180cd6436b
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyCharComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyCharComponent : IComponent
6 | {
7 | public char Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyCharComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3b77b0155ae246a4b0a585ff0ef3a153
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyCustomObjectComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyCustomObjectComponent : IComponent
6 | {
7 | public MyCustomObject Value;
8 | }
9 |
10 | public class MyCustomObject
11 | {
12 | public string Name;
13 |
14 | public MyCustomObject(string name)
15 | {
16 | Name = name;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyCustomObjectComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eecc2a73ca63436485acaf861665bf71
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDateTimeComponent.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using Entitas;
3 | using Entitas.Generators.Attributes;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyDateTimeComponent : IComponent
7 | {
8 | public DateTime Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDateTimeComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d00ba15066ed4ae89571832b1702c7fb
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDictArrayComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 | using Entitas.Generators.Attributes;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyDictArrayComponent : IComponent
7 | {
8 | public Dictionary Dict;
9 | public Dictionary[] DictArray;
10 | }
11 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDictArrayComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 244ce0249a4241ef98ecb6a50e3403cd
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDictionaryComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 | using Entitas.Generators.Attributes;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyDictionaryComponent : IComponent
7 | {
8 | public Dictionary Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDictionaryComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8d1bfafeb2824ce3ad3f77528ebf1e9b
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDontDrawComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using Entitas.Unity;
4 |
5 | [Context(typeof(GameContext)), DontDrawComponent]
6 | public sealed class MyDontDrawComponent : IComponent
7 | {
8 | public MySimpleObject Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyDontDrawComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9de382a297974f668bf96f81d0322aec
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyFlagComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyFlagComponent : IComponent { }
6 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyFlagComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ffc162171ca324d40985306053b0bc26
3 | timeCreated: 1455739666
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyHashSetComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 | using Entitas.Generators.Attributes;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyHashSetComponent : IComponent
7 | {
8 | public HashSet Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyHashSetComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 86b49e56cb2c45b19c2e1e71e79e4969
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyJaggedArrayComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyJaggedArrayComponent : IComponent
6 | {
7 | public string[][] Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyJaggedArrayComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 441ea2d1ab54433f8f478b274b5895ff
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyListArrayComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 | using Entitas.Generators.Attributes;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyListArrayComponent : IComponent
7 | {
8 | public List[] Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyListArrayComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b58f3f34a6f34172bc4c93fed2a79b18
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyListComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 | using Entitas.Generators.Attributes;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyListComponent : IComponent
7 | {
8 | public List Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyListComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: eaaacc8162f64d25b71d157ba61d15ce
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyMemberListComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyMemberListComponent : IComponent
6 | {
7 | public string Field1;
8 | public string Field2;
9 | public string Field3;
10 | public string Field4;
11 | public string Field5;
12 | public string Field6;
13 | public string Field7;
14 | public string Field8;
15 | public string Field9;
16 | public string Field10;
17 | public string Field11;
18 | public string Field12;
19 | }
20 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyMemberListComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e189a338eb33432d8209e890900c8271
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyMonoBehaviourSubClassComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyMonoBehaviourSubClassComponent : IComponent
7 | {
8 | public MyMonoBehaviourSubClass Value;
9 | }
10 |
11 | public class MyMonoBehaviourSubClass : MonoBehaviour { }
12 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyMonoBehaviourSubClassComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e95c61aa3b494c1f8f289c1be247369a
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyPersonComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyPersonComponent : IComponent
6 | {
7 | public string Name;
8 | public string Gender;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyPersonComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a7251cf074c2417d9ab628ebc39842cc
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyPropertyComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyPropertyComponent : IComponent
6 | {
7 | public string Value { get; set; }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyPropertyComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cc2f53ac7164424ab6219efff219eef2
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MySimpleObjectComponent.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 | using Entitas.Generators.Attributes;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MySimpleObjectComponent : IComponent
7 | {
8 | public MySimpleObject Value;
9 | }
10 |
11 | public class MySimpleObject
12 | {
13 | public string Name;
14 | public int Age;
15 | public Dictionary Data;
16 | public MyCustomObject MyCustomObject;
17 | public MySimpleObject Next;
18 | }
19 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MySimpleObjectComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 55948d11b3424ecd81ec848e2b893a33
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MySystemObjectComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MySystemObjectComponent : IComponent
6 | {
7 | public System.Object Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MySystemObjectComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c7d9ee97b0ad4688a2ce1b1b88d1e047
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyUniqueComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext)), Unique]
5 | public sealed class MyUniqueComponent : IComponent
6 | {
7 | public string Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyUniqueComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 33368b26a3264a8e8db86b4299e8d7e1
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyUnsupportedObjectComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyUnsupportedObjectComponent : IComponent
6 | {
7 | public UnsupportedObject Value;
8 | }
9 |
10 | public class UnsupportedObject
11 | {
12 | public string Value;
13 |
14 | public UnsupportedObject(string value)
15 | {
16 | Value = value;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/MyUnsupportedObjectComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 97beb1b2da064350968b5eb8d89e386d
3 | timeCreated: 1667936395
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: fc42c211fea84a67a0ed15d5d9a3cb8b
3 | timeCreated: 1667936693
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyAnimationCurveComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyAnimationCurveComponent : IComponent
7 | {
8 | public AnimationCurve Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyAnimationCurveComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: cd6ffe73cc91487da0205160330a0203
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoolComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyBoolComponent : IComponent
6 | {
7 | public bool Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoolComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6114f99c89284d02bba2818f93d4b488
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoundsComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyBoundsComponent : IComponent
7 | {
8 | public Bounds Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyBoundsComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 607c2d9959a6e4db58ece12f4d320a0f
3 | timeCreated: 1455739666
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyColorComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyColorComponent : IComponent
7 | {
8 | public Color Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyColorComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: de957506614f4d9fb03ea4b5267ca0bc
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyDoubleComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyDoubleComponent : IComponent
6 | {
7 | public double Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyDoubleComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ae6e38e9a97b44d5b79250a7a84d4c83
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyEnumComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyEnumComponent : IComponent
6 | {
7 | public MyEnum Value;
8 | }
9 |
10 | public enum MyEnum
11 | {
12 | Item1,
13 | Item2,
14 | Item3
15 | }
16 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyEnumComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 13ec734e954d45daa3feb3293b4d4e02
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFlagsComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyFlagsComponent : IComponent
6 | {
7 | public MyFlags Value;
8 | }
9 |
10 | [System.Flags]
11 | public enum MyFlags
12 | {
13 | Item1 = 1,
14 | Item2 = 2,
15 | Item3 = 4,
16 | Item4 = 8
17 | }
18 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFlagsComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 7eca5917c1e943029dca756272db5679
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFloatComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyFloatComponent : IComponent
6 | {
7 | public float Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyFloatComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 614252080b7d4a03b49a0ed5d2e1682d
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyGameObjectComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyGameObjectComponent : IComponent
7 | {
8 | public GameObject Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyGameObjectComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 67a47ddd017646da9db95a6c52a7bbd5
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyIntComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext))]
5 | public sealed class MyIntComponent : IComponent
6 | {
7 | public int Value;
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyIntComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 38b3229004104b9aa19c34de5ee2812a
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyRectComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyRectComponent : IComponent
7 | {
8 | public Rect Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyRectComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 314993c54360444ebd3ac933a667f11a
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyStringComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext)), Context(typeof(InputContext))]
5 | public sealed class MyStringComponent : IComponent
6 | {
7 | public string Value;
8 |
9 | public override string ToString() => $"MyString({Value})";
10 | }
11 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyStringComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b4c6e703065242cc95c2c2917ecb9c42
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTexture2DComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyTexture2DComponent : IComponent
7 | {
8 | public Texture2D Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTexture2DComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ee9f3e8394d44a99867d24b55aa3e4f4
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTextureComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyTextureComponent : IComponent
7 | {
8 | public Texture Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyTextureComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: c4cdcbb081214b9d9b2b086ecd49f209
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyUnityObjectComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyUnityObjectComponent : IComponent
7 | {
8 | public Object Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyUnityObjectComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d0cfe10a31f443a580841ff640c31a00
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector2Component.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyVector2Component : IComponent
7 | {
8 | public Vector2 Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector2Component.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4f7d2cc8dac94298abcf672906c17cf7
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector3Component.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyVector3Component : IComponent
7 | {
8 | public Vector3 Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector3Component.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5df4c97495d94a75ab8ab1a5f1ccef46
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector4Component.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using UnityEngine;
4 |
5 | [Context(typeof(GameContext))]
6 | public sealed class MyVector4Component : IComponent
7 | {
8 | public Vector4 Value;
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Components/UnityBuiltInTypes/MyVector4Component.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3ef196888c544a12b34f68e104a3af96
3 | timeCreated: 1667936720
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/ComponentsController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: b7a971593563c452781677abaf62f41b
3 | timeCreated: 1455739666
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Contexts.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 68d5ad989369407ca8a797a7f2921ff1
3 | timeCreated: 1690465858
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Contexts/ContextInitialization.cs:
--------------------------------------------------------------------------------
1 | using Entitas.Generators.Attributes;
2 |
3 | public static partial class ContextInitialization
4 | {
5 | public static void InitializeAllContexts()
6 | {
7 | InitializeGameContext();
8 | InitializeInputContext();
9 | }
10 |
11 | [ContextInitialization(typeof(GameContext))]
12 | public static partial void InitializeGameContext();
13 |
14 | [ContextInitialization(typeof(InputContext))]
15 | public static partial void InitializeInputContext();
16 | }
17 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Contexts/ContextInitialization.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3de139e489844b6fb5d326d5cfe52aff
3 | timeCreated: 1690465874
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Contexts/GameContext.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | partial class GameContext : IContext { }
4 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Contexts/GameContext.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a13516d2b8cd420c8a7613f2f3bc4480
3 | timeCreated: 1690465381
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Contexts/InputContext.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | partial class InputContext : IContext { }
4 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Contexts/InputContext.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 87b3133efe3d436eb8e6f77b85622d45
3 | timeCreated: 1690465697
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e2a9126de78c74296a0da24cc0363b9a
3 | timeCreated: 1455739666
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b323d75517db4e3ba60b474a4c6c595
3 | folderAsset: yes
4 | timeCreated: 1455739666
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/AReactiveSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Threading;
3 | using Entitas;
4 |
5 | public class AReactiveSystem : ReactiveSystem
6 | {
7 | public AReactiveSystem(GameContext context) : base(context) { }
8 |
9 | protected override ICollector GetTrigger(IContext context) =>
10 | context.CreateCollector(GameMyStringMatcher.MyString);
11 |
12 | protected override bool Filter(Game.Entity entity) => true;
13 |
14 | protected override void Execute(List entities)
15 | {
16 | Thread.Sleep(2);
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/AReactiveSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8133bd2e30cfc4cd9a1ab205c8b3a288
3 | timeCreated: 1432070018
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/CleanupSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class CleanupSystem : ICleanupSystem
4 | {
5 | public void Cleanup() { }
6 | }
7 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/CleanupSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 26667bf2484024d36b5cca1aaf56f8de
3 | timeCreated: 1475865147
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/FastSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using Entitas;
3 |
4 | public class FastSystem : IExecuteSystem
5 | {
6 | public void Execute()
7 | {
8 | Thread.Sleep(1);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/FastSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4dbba0f12e8184b3a8ab30d670ca9692
3 | timeCreated: 1432070018
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/MixedSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class MixedSystem : IInitializeSystem, IExecuteSystem, ICleanupSystem, ITearDownSystem
4 | {
5 | public void Initialize()
6 | {
7 | //UnityEngine.Debug.Log("Initialize");
8 | }
9 |
10 | public void Execute()
11 | {
12 | //UnityEngine.Debug.Log("Execute");
13 | }
14 |
15 | public void Cleanup()
16 | {
17 | //UnityEngine.Debug.Log("Cleanup");
18 | }
19 |
20 | public void TearDown()
21 | {
22 | //UnityEngine.Debug.Log("TearDown");
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/MixedSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4ec7357cbe250481ebe3f79876871c99
3 | timeCreated: 1475869353
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/ProcessRandomValueSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 |
4 | public class ProcessRandomValueSystem : ReactiveSystem
5 | {
6 | public ProcessRandomValueSystem(GameContext context) : base(context) { }
7 |
8 | protected override ICollector GetTrigger(IContext context) =>
9 | context.CreateCollector(GameMyFloatMatcher.MyFloat);
10 |
11 | protected override bool Filter(Game.Entity entity) => true;
12 |
13 | protected override void Execute(List entities)
14 | {
15 | foreach (var entity in entities)
16 | entity.Destroy();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/ProcessRandomValueSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e29e8e4de9c25452882614e48c0287a3
3 | timeCreated: 1437218791
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/RandomDurationSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using UnityEngine;
3 | using Entitas;
4 |
5 | public class RandomDurationSystem : IExecuteSystem
6 | {
7 | public void Execute()
8 | {
9 | Thread.Sleep(Random.Range(0, 9));
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/RandomDurationSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 3d923a0b40aec4c62a883bcf5d32266e
3 | timeCreated: 1432152477
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/RandomValueSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using UnityEngine;
3 |
4 | public class RandomValueSystem : IExecuteSystem
5 | {
6 | readonly GameContext _context;
7 |
8 | public RandomValueSystem(GameContext context)
9 | {
10 | _context = context;
11 | }
12 |
13 | public void Execute()
14 | {
15 | _context.CreateEntity().AddMyFloat(Random.value);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/RandomValueSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5470c556108894357a24a68dd92da480
3 | timeCreated: 1437218791
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeExecuteSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using Entitas;
3 |
4 | public class SlowInitializeExecuteSystem : IInitializeSystem, IExecuteSystem
5 | {
6 | public void Initialize()
7 | {
8 | Thread.Sleep(10);
9 | }
10 |
11 | public void Execute()
12 | {
13 | Thread.Sleep(5);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeExecuteSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 651ddcb189b494f1fb48addac219efb9
3 | timeCreated: 1439754586
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using Entitas;
3 |
4 | public class SlowInitializeSystem : IInitializeSystem
5 | {
6 | public void Initialize()
7 | {
8 | Thread.Sleep(30);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SlowInitializeSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 57c7a0da41d924d80a58d9e78528fbbe
3 | timeCreated: 1439754586
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SlowSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Threading;
2 | using Entitas;
3 |
4 | public class SlowSystem : IExecuteSystem
5 | {
6 | public void Execute()
7 | {
8 | Thread.Sleep(4);
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SlowSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ae066f52c9bcc4079a6c20142b5150fa
3 | timeCreated: 1432070018
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeExecuteSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class SomeExecuteSystem : IExecuteSystem
4 | {
5 | public void Execute() { }
6 | }
7 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeExecuteSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 351bfdecb9eef45019db0b774e0b0652
3 | timeCreated: 1433409297
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeExecuteSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class SomeInitializeExecuteSystem : IInitializeSystem, IExecuteSystem
4 | {
5 | public void Initialize() { }
6 |
7 | public void Execute() { }
8 | }
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeExecuteSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: ebb325d92872b412b8b4da1e47651ca7
3 | timeCreated: 1439754586
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeReactiveSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 |
4 | public class SomeInitializeReactiveSystem : ReactiveSystem, IInitializeSystem
5 | {
6 | public SomeInitializeReactiveSystem(GameContext context) : base(context) { }
7 |
8 | protected override ICollector GetTrigger(IContext context) =>
9 | context.CreateCollector(Game.Matcher.AllOf(0));
10 |
11 | protected override bool Filter(Game.Entity entity) => true;
12 |
13 | public void Initialize() { }
14 |
15 | protected override void Execute(List entities) { }
16 | }
17 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeReactiveSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 13904dc9959364090bef258311f3183a
3 | timeCreated: 1439754586
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class SomeInitializeSystem : IInitializeSystem
4 | {
5 | public void Initialize() { }
6 | }
7 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeInitializeSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 27103eba44f8a4d8b927a9bcdaf488a5
3 | timeCreated: 1439754586
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeReactiveSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 |
4 | public class SomeReactiveSystem : ReactiveSystem
5 | {
6 | public SomeReactiveSystem(GameContext context) : base(context) { }
7 |
8 | protected override ICollector GetTrigger(IContext context) =>
9 | context.CreateCollector(Matcher.AllOf(0));
10 |
11 | protected override bool Filter(Game.Entity entity) => true;
12 |
13 | protected override void Execute(List entities) { }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/SomeReactiveSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5c67dabd77edc40f1b8a6d30e6b54799
3 | timeCreated: 1433409297
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/TearDownSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class TearDownSystem : ITearDownSystem
4 | {
5 | public void TearDown()
6 | {
7 | UnityEngine.Debug.Log("TearDown");
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/Systems/TearDownSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: e9f7d828623b24718b8d95c4ec445697
3 | timeCreated: 1475865479
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Runtime/SystemsController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 673279bc6aa4344039fa3f2674348d6f
3 | timeCreated: 1455739666
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 403c2dea987524f5abb71c8714c790eb
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Editor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 24957586ae4bc4cc383f088a35ff09de
3 | folderAsset: yes
4 | timeCreated: 1455740206
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Editor/Tests.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 99230376fec554ead9805e15092fc6a8
3 | folderAsset: yes
4 | timeCreated: 1450119188
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Editor/Tests/ContextTests.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using NUnit.Framework;
3 | using Entitas;
4 |
5 | [TestFixture]
6 | class ContextTests
7 | {
8 | [Test]
9 | public void EnsuresSameDeterministicOrderWhenGettingEntitiesAfterDestroyAllEntities()
10 | {
11 | ContextInitialization.InitializeAllContexts();
12 | var gameContext = new Context(1, () => new Game.Entity());
13 |
14 | const int numEntities = 10;
15 |
16 | for (var i = 0; i < numEntities; i++)
17 | gameContext.CreateEntity();
18 |
19 | var order1 = gameContext.GetEntities().Select(entity => entity.Id).ToArray();
20 |
21 | gameContext.Reset();
22 |
23 | for (var i = 0; i < numEntities; i++)
24 | gameContext.CreateEntity();
25 |
26 | var order2 = gameContext.GetEntities().Select(entity => entity.Id).ToArray();
27 |
28 | for (var i = 0; i < numEntities; i++)
29 | {
30 | var index1 = order1[i];
31 | var index2 = order2[i];
32 |
33 | Assert.AreEqual(index1, index2);
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Editor/Tests/ContextTests.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 640477ba833484d4b9ca68074efa0c9a
3 | timeCreated: 1483966795
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Editor/Tests/EntityLinkTests.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 56872c04364084e3c9fdd237e9f388c4
3 | timeCreated: 1486169352
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8c5e0db5fd8544447bfef576d96efc55
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5a4cd696ee62a4922a0f739f7afaa6fb
3 | folderAsset: yes
4 | timeCreated: 1454970059
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor/Collector Destructor.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2bcfbecd3f0a64750a3d8f54424d44fe
3 | timeCreated: 1454970059
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor/CollectorDestructorController.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 | using Entitas;
3 | using Entitas.Unity;
4 | using UnityEditor;
5 |
6 | public class CollectorDestructorController : MonoBehaviour
7 | {
8 | GameContext _gameContext;
9 | Game.Entity _initialEntity;
10 |
11 | void Start()
12 | {
13 | ContextInitialization.InitializeAllContexts();
14 | _gameContext = new GameContext();
15 | _gameContext.CreateContextObserver();
16 | _gameContext.GetGroup(GameTestMatcher.Test).CreateCollector();
17 | _initialEntity = _gameContext.CreateEntity();
18 | _initialEntity.AddTest();
19 | _initialEntity.Destroy();
20 | // TODO
21 | // context.ClearGroups();
22 | }
23 |
24 | void Update()
25 | {
26 | for (var i = 0; i < 5000; i++)
27 | {
28 | var entity = _gameContext.CreateEntity();
29 | if (entity == _initialEntity)
30 | {
31 | Debug.Log("Reusing entity!");
32 | EditorApplication.isPlaying = false;
33 | }
34 | }
35 | }
36 | }
37 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Collector Destructor/CollectorDestructorController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 10fd605a7d77b4db381962061246c923
3 | timeCreated: 1454970059
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 716397237436b4443bd27b1266b106cf
3 | folderAsset: yes
4 | DefaultImporter:
5 | externalObjects: {}
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test/Entity Stress Test Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 9693b73c9c95a4c2e951176a1fb5b355
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test/EntityStressTestController.cs:
--------------------------------------------------------------------------------
1 | using Entitas.Unity;
2 | using UnityEngine;
3 |
4 | public class EntityStressTestController : MonoBehaviour
5 | {
6 | public int count;
7 |
8 | GameContext _gameContext;
9 | bool _flag;
10 |
11 | void Start()
12 | {
13 | ContextInitialization.InitializeAllContexts();
14 | _gameContext = new GameContext();
15 | _gameContext.CreateContextObserver();
16 |
17 | // for (var i = 0; i < count; i++)
18 | // {
19 | // var e = _contexts.game.CreateEntity();
20 | // e.AddMyInt(i);
21 | // e.AddMyString(i.ToString());
22 | // }
23 | }
24 |
25 | void Update()
26 | {
27 | // foreach (var e in _contexts.game.GetEntities())
28 | // e.ReplaceMyInt(e.myInt.Value + 1);
29 |
30 | if (Time.frameCount % 60 == 0)
31 | {
32 | _flag = !_flag;
33 | if (_flag)
34 | for (var i = 0; i < count; i++)
35 | _gameContext.CreateEntity().AddMyInt(i);
36 | else
37 | foreach (var entity in _gameContext.GetEntities())
38 | entity.Destroy();
39 | }
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Entity Stress Test/EntityStressTestController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 285cc2b6c9e60419fb51e48c0011bb12
3 | MonoImporter:
4 | externalObjects: {}
5 | serializedVersion: 2
6 | defaultReferences: []
7 | executionOrder: 0
8 | icon: {instanceID: 0}
9 | userData:
10 | assetBundleName:
11 | assetBundleVariant:
12 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 802031397194d49dc9b2b8a534477d68
3 | folderAsset: yes
4 | timeCreated: 1508969008
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink/EntityLink Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 4c3fef27b9afc47678153f816cb06e08
3 | timeCreated: 1515794709
4 | licenseType: Free
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink/EntityLinkController.cs:
--------------------------------------------------------------------------------
1 | using Entitas.Unity;
2 | using UnityEngine;
3 |
4 | public class EntityLinkController : MonoBehaviour
5 | {
6 | void Start()
7 | {
8 | ContextInitialization.InitializeAllContexts();
9 | var gameContext = new GameContext();
10 | gameContext.CreateContextObserver();
11 | var entity = gameContext.CreateEntity();
12 |
13 | var go = new GameObject();
14 | go.Link(entity);
15 |
16 | entity.AddMyGameObject(go);
17 |
18 | // go.Unlink();
19 |
20 | Destroy(go);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/EntityLink/EntityLinkController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 6b7bce7896e0347d7bb51d6f8c8802e2
3 | timeCreated: 1515794616
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a264ebe020ce546b183f93b3f1e5a48b
3 | folderAsset: yes
4 | timeCreated: 1457784847
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 |
4 | [Context(typeof(GameContext)), Context(typeof(InputContext))]
5 | public sealed class TestComponent : IComponent { }
6 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestComponent.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 58dcfa315ac634f55b4f704b27a6d993
3 | timeCreated: 1454969455
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestReactiveSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 |
4 | public class TestReactiveSystem : ReactiveSystem
5 | {
6 | public TestReactiveSystem(GameContext context) : base(context) { }
7 |
8 | protected override ICollector GetTrigger(IContext context) =>
9 | context.CreateCollector(GameTestMatcher.Test);
10 |
11 | protected override bool Filter(Game.Entity entity) => true;
12 |
13 | protected override void Execute(List entities) { }
14 | }
15 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Fixtures/TestReactiveSystem.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 224fbeb414af74d3ea0a3ab23bf8ff71
3 | timeCreated: 1454969689
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 8e86e453905c642329467e859a3b8f3b
3 | folderAsset: yes
4 | timeCreated: 1519479356
5 | licenseType: Free
6 | DefaultImporter:
7 | externalObjects: {}
8 | userData:
9 | assetBundleName:
10 | assetBundleVariant:
11 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc/Group Alloc Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: d9150b74acc734ada9a516a0fc679c99
3 | timeCreated: 1519479689
4 | licenseType: Free
5 | DefaultImporter:
6 | externalObjects: {}
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Group Alloc/GroupAllocController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 78eba33893cf04b228baa507095ea482
3 | timeCreated: 1519479366
4 | licenseType: Free
5 | MonoImporter:
6 | externalObjects: {}
7 | serializedVersion: 2
8 | defaultReferences: []
9 | executionOrder: 0
10 | icon: {instanceID: 0}
11 | userData:
12 | assetBundleName:
13 | assetBundleVariant:
14 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 95a1991d296b43cdacda4c6f66a842e5
3 | timeCreated: 1539714655
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception/Reactive System Exception Scene.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: a15993e3c6d0c42ca90a69ab47e5418e
3 | DefaultImporter:
4 | externalObjects: {}
5 | userData:
6 | assetBundleName:
7 | assetBundleVariant:
8 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/Reactive System Exception/ReactiveSystemExceptionController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: af88d9eb7bda418db410c5a1d92d419b
3 | timeCreated: 1539714679
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 5b42989fff2b74bbf9e97aa602022f12
3 | folderAsset: yes
4 | timeCreated: 1454969316
5 | licenseType: Pro
6 | DefaultImporter:
7 | userData:
8 | assetBundleName:
9 | assetBundleVariant:
10 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor/ReactiveSystem Destructor.unity.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 2c07bbb67ef0741c587e02a7ab9a476b
3 | timeCreated: 1454969404
4 | licenseType: Pro
5 | DefaultImporter:
6 | userData:
7 | assetBundleName:
8 | assetBundleVariant:
9 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor/ReactiveSystemDestructorController.cs:
--------------------------------------------------------------------------------
1 | using Entitas.Unity;
2 | using UnityEngine;
3 | using UnityEditor;
4 |
5 | public class ReactiveSystemDestructorController : MonoBehaviour
6 | {
7 | GameContext _gameContext;
8 | Game.Entity _initialEntity;
9 |
10 | void Start()
11 | {
12 | ContextInitialization.InitializeAllContexts();
13 | _gameContext = new GameContext();
14 | _gameContext.CreateContextObserver();
15 | new TestReactiveSystem(_gameContext);
16 | _initialEntity = _gameContext.CreateEntity();
17 | _initialEntity.AddTest();
18 | _initialEntity.Destroy();
19 | }
20 |
21 | void Update()
22 | {
23 | for (var i = 0; i < 5000; i++)
24 | {
25 | var e = _gameContext.CreateEntity();
26 | if (e == _initialEntity)
27 | {
28 | Debug.Log("Success: Reusing entity!");
29 | EditorApplication.isPlaying = false;
30 | }
31 | }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/samples/Unity/Assets/Sample/Tests/Manual Tests/ReactiveSystem Destructor/ReactiveSystemDestructorController.cs.meta:
--------------------------------------------------------------------------------
1 | fileFormatVersion: 2
2 | guid: 60cd40ead19244af69139bcae307ac31
3 | timeCreated: 1454969436
4 | licenseType: Pro
5 | MonoImporter:
6 | serializedVersion: 2
7 | defaultReferences: []
8 | executionOrder: 0
9 | icon: {instanceID: 0}
10 | userData:
11 | assetBundleName:
12 | assetBundleVariant:
13 |
--------------------------------------------------------------------------------
/samples/Unity/Entitas.properties:
--------------------------------------------------------------------------------
1 | Entitas.VisualDebugging.Unity.Editor.SystemWarningThreshold = 1
2 | Entitas.VisualDebugging.Unity.Editor.DefaultInstanceCreatorFolderPath = Assets/Editor/DefaultInstanceCreator
3 | Entitas.VisualDebugging.Unity.Editor.TypeDrawerFolderPath = Assets/Editor/TypeDrawer
4 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/AudioManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!11 &1
4 | AudioManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Volume: 1
8 | Rolloff Scale: 1
9 | Doppler Factor: 1
10 | Default Speaker Mode: 2
11 | m_SampleRate: 0
12 | m_DSPBufferSize: 1024
13 | m_VirtualVoiceCount: 512
14 | m_RealVoiceCount: 32
15 | m_SpatializerPlugin:
16 | m_AmbisonicDecoderPlugin:
17 | m_DisableAudio: 0
18 | m_VirtualizeEffects: 1
19 | m_RequestedDSPBufferSize: 1024
20 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/ClusterInputManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!236 &1
4 | ClusterInputManager:
5 | m_ObjectHideFlags: 0
6 | m_Inputs: []
7 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/DynamicsManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!55 &1
4 | PhysicsManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 11
7 | m_Gravity: {x: 0, y: -9.81, z: 0}
8 | m_DefaultMaterial: {fileID: 0}
9 | m_BounceThreshold: 2
10 | m_SleepThreshold: 0.005
11 | m_DefaultContactOffset: 0.01
12 | m_DefaultSolverIterations: 6
13 | m_DefaultSolverVelocityIterations: 1
14 | m_QueriesHitBackfaces: 0
15 | m_QueriesHitTriggers: 1
16 | m_EnableAdaptiveForce: 0
17 | m_ClothInterCollisionDistance: 0
18 | m_ClothInterCollisionStiffness: 0
19 | m_ContactsGeneration: 1
20 | m_LayerCollisionMatrix: ffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffff
21 | m_AutoSimulation: 1
22 | m_AutoSyncTransforms: 0
23 | m_ReuseCollisionCallbacks: 1
24 | m_ClothInterCollisionSettingsToggle: 0
25 | m_ContactPairsMode: 0
26 | m_BroadphaseType: 0
27 | m_WorldBounds:
28 | m_Center: {x: 0, y: 0, z: 0}
29 | m_Extent: {x: 250, y: 250, z: 250}
30 | m_WorldSubdivisions: 8
31 | m_FrictionType: 0
32 | m_EnableEnhancedDeterminism: 0
33 | m_EnableUnifiedHeightmaps: 1
34 | m_DefaultMaxAngluarSpeed: 7
35 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/EditorBuildSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1045 &1
4 | EditorBuildSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_Scenes: []
8 | m_configObjects: {}
9 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/MemorySettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!387306366 &1
4 | MemorySettings:
5 | m_ObjectHideFlags: 0
6 | m_EditorMemorySettings:
7 | m_MainAllocatorBlockSize: -1
8 | m_ThreadAllocatorBlockSize: -1
9 | m_MainGfxBlockSize: -1
10 | m_ThreadGfxBlockSize: -1
11 | m_CacheBlockSize: -1
12 | m_TypetreeBlockSize: -1
13 | m_ProfilerBlockSize: -1
14 | m_ProfilerEditorBlockSize: -1
15 | m_BucketAllocatorGranularity: -1
16 | m_BucketAllocatorBucketsCount: -1
17 | m_BucketAllocatorBlockSize: -1
18 | m_BucketAllocatorBlockCount: -1
19 | m_ProfilerBucketAllocatorGranularity: -1
20 | m_ProfilerBucketAllocatorBucketsCount: -1
21 | m_ProfilerBucketAllocatorBlockSize: -1
22 | m_ProfilerBucketAllocatorBlockCount: -1
23 | m_TempAllocatorSizeMain: -1
24 | m_JobTempAllocatorBlockSize: -1
25 | m_BackgroundJobTempAllocatorBlockSize: -1
26 | m_JobTempAllocatorReducedBlockSize: -1
27 | m_TempAllocatorSizeGIBakingWorker: -1
28 | m_TempAllocatorSizeNavMeshWorker: -1
29 | m_TempAllocatorSizeAudioWorker: -1
30 | m_TempAllocatorSizeCloudWorker: -1
31 | m_TempAllocatorSizeGfx: -1
32 | m_TempAllocatorSizeJobWorker: -1
33 | m_TempAllocatorSizeBackgroundWorker: -1
34 | m_TempAllocatorSizePreloadManager: -1
35 | m_PlatformMemorySettings: {}
36 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/PackageManagerSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!114 &1
4 | MonoBehaviour:
5 | m_ObjectHideFlags: 61
6 | m_CorrespondingSourceObject: {fileID: 0}
7 | m_PrefabInstance: {fileID: 0}
8 | m_PrefabAsset: {fileID: 0}
9 | m_GameObject: {fileID: 0}
10 | m_Enabled: 1
11 | m_EditorHideFlags: 0
12 | m_Script: {fileID: 13964, guid: 0000000000000000e000000000000000, type: 0}
13 | m_Name:
14 | m_EditorClassIdentifier:
15 | m_EnablePreReleasePackages: 0
16 | m_EnablePackageDependencies: 0
17 | m_AdvancedSettingsExpanded: 1
18 | m_ScopedRegistriesSettingsExpanded: 1
19 | m_SeeAllPackageVersions: 0
20 | oneTimeWarningShown: 0
21 | m_Registries:
22 | - m_Id: main
23 | m_Name:
24 | m_Url: https://packages.unity.com
25 | m_Scopes: []
26 | m_IsDefault: 1
27 | m_Capabilities: 7
28 | m_UserSelectedRegistryName:
29 | m_UserAddingNewScopedRegistry: 0
30 | m_RegistryInfoDraft:
31 | m_Modified: 0
32 | m_ErrorMessage:
33 | m_UserModificationsInstanceId: -830
34 | m_OriginalInstanceId: -832
35 | m_LoadAssets: 0
36 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/PresetManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!1386491679 &1
4 | PresetManager:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 2
7 | m_DefaultPresets: {}
8 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/ProjectVersion.txt:
--------------------------------------------------------------------------------
1 | m_EditorVersion: 2022.3.0f1
2 | m_EditorVersionWithRevision: 2022.3.0f1 (fb119bb0b476)
3 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/TagManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!78 &1
4 | TagManager:
5 | serializedVersion: 2
6 | tags: []
7 | layers:
8 | - Default
9 | - TransparentFX
10 | - Ignore Raycast
11 | -
12 | - Water
13 | - UI
14 | -
15 | -
16 | -
17 | -
18 | -
19 | -
20 | -
21 | -
22 | -
23 | -
24 | -
25 | -
26 | -
27 | -
28 | -
29 | -
30 | -
31 | -
32 | -
33 | -
34 | -
35 | -
36 | -
37 | -
38 | -
39 | -
40 | m_SortingLayers:
41 | - name: Default
42 | uniqueID: 0
43 | locked: 0
44 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/TimeManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!5 &1
4 | TimeManager:
5 | m_ObjectHideFlags: 0
6 | Fixed Timestep: 0.02
7 | Maximum Allowed Timestep: 0.33333334
8 | m_TimeScale: 1
9 | Maximum Particle Timestep: 0.03
10 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/UnityConnectSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!310 &1
4 | UnityConnectSettings:
5 | m_ObjectHideFlags: 0
6 | serializedVersion: 1
7 | m_Enabled: 0
8 | m_TestMode: 0
9 | m_EventOldUrl: https://api.uca.cloud.unity3d.com/v1/events
10 | m_EventUrl: https://cdp.cloud.unity3d.com/v1/events
11 | m_ConfigUrl: https://config.uca.cloud.unity3d.com
12 | m_DashboardUrl: https://dashboard.unity3d.com
13 | m_TestInitMode: 0
14 | CrashReportingSettings:
15 | m_EventUrl: https://perf-events.cloud.unity3d.com
16 | m_Enabled: 0
17 | m_LogBufferSize: 10
18 | m_CaptureEditorExceptions: 1
19 | UnityPurchasingSettings:
20 | m_Enabled: 0
21 | m_TestMode: 0
22 | UnityAnalyticsSettings:
23 | m_Enabled: 0
24 | m_TestMode: 0
25 | m_InitializeOnStartup: 1
26 | UnityAdsSettings:
27 | m_Enabled: 0
28 | m_InitializeOnStartup: 1
29 | m_TestMode: 0
30 | m_IosGameId:
31 | m_AndroidGameId:
32 | m_GameIds: {}
33 | m_GameId:
34 | PerformanceReportingSettings:
35 | m_Enabled: 0
36 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/VFXManager.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!937362698 &1
4 | VFXManager:
5 | m_ObjectHideFlags: 0
6 | m_IndirectShader: {fileID: 0}
7 | m_CopyBufferShader: {fileID: 0}
8 | m_SortShader: {fileID: 0}
9 | m_StripUpdateShader: {fileID: 0}
10 | m_RenderPipeSettingsPath:
11 | m_FixedTimeStep: 0.016666668
12 | m_MaxDeltaTime: 0.05
13 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/VersionControlSettings.asset:
--------------------------------------------------------------------------------
1 | %YAML 1.1
2 | %TAG !u! tag:unity3d.com,2011:
3 | --- !u!890905787 &1
4 | VersionControlSettings:
5 | m_ObjectHideFlags: 0
6 | m_Mode: Visible Meta Files
7 | m_CollabEditorSettings:
8 | inProgressEnabled: 1
9 |
--------------------------------------------------------------------------------
/samples/Unity/ProjectSettings/XRSettings.asset:
--------------------------------------------------------------------------------
1 | {
2 | "m_SettingKeys": [
3 | "VR Device Disabled",
4 | "VR Device User Alert"
5 | ],
6 | "m_SettingValues": [
7 | "False",
8 | "False"
9 | ]
10 | }
--------------------------------------------------------------------------------
/samples/Unity/restore_unity.bash:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -euo pipefail
3 | IFS=$'\n\t'
4 |
5 | UNITY_PROJECTS=(samples/Unity)
6 |
7 | declare -A PROJECTS=(
8 | [Entitas]=Assets/Plugins
9 | [Entitas.Generators.Attributes]=Assets/Plugins
10 | [Entitas.Unity]=Assets/Plugins
11 | [Entitas.Unity.Editor]=Assets/Plugins/Editor
12 | )
13 |
14 | for unity_project_path in "${UNITY_PROJECTS[@]}"; do
15 | echo "Restore Entitas: ${unity_project_path}"
16 | for project in "${!PROJECTS[@]}"; do
17 | echo "Restore ${project}: ${unity_project_path}"
18 | project_path="${unity_project_path}/${PROJECTS["${project}"]}"
19 | mkdir -p "${project_path}"
20 | rsync \
21 | --archive \
22 | --recursive \
23 | --prune-empty-dirs \
24 | --include='*/' \
25 | --include='**/*.cs' \
26 | --include='**/*.png' \
27 | --include='**/*.png.meta' \
28 | --exclude='*' \
29 | "src/${project}" "${project_path}"
30 | done
31 |
32 | echo "Restore Dotfiles: ${unity_project_path}"
33 | mkdir -p "${unity_project_path}/.sln.dotsettings/"
34 | cp Entitas.sln.DotSettings "${unity_project_path}/$(basename "${unity_project_path}").sln.DotSettings"
35 | cp .sln.dotsettings/*.DotSettings "${unity_project_path}/.sln.dotsettings/"
36 | cp .editorconfig "${unity_project_path}"
37 | done
38 |
--------------------------------------------------------------------------------
/src/Entitas.Generators.Attributes/CleanupAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Generators.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class CleanupAttribute : Attribute
7 | {
8 | public readonly CleanupMode CleanupMode;
9 |
10 | public CleanupAttribute(CleanupMode cleanupMode)
11 | {
12 | CleanupMode = cleanupMode;
13 | }
14 | }
15 |
16 | public enum CleanupMode
17 | {
18 | RemoveComponent,
19 | DestroyEntity
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/src/Entitas.Generators.Attributes/ContextAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Generators.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
6 | public class ContextAttribute : Attribute
7 | {
8 | public readonly Type Type;
9 |
10 | public ContextAttribute(Type type)
11 | {
12 | Type = type;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Entitas.Generators.Attributes/ContextInitializationAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Generators.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Method)]
6 | public class ContextInitializationAttribute : Attribute
7 | {
8 | public readonly Type Type;
9 |
10 | public ContextInitializationAttribute(Type type)
11 | {
12 | Type = type;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Entitas.Generators.Attributes/Entitas.Generators.Attributes.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultTargetFramework)
5 | 2.0.0
6 | enable
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/src/Entitas.Generators.Attributes/EntityIndexAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Generators.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Field | AttributeTargets.Property)]
6 | public class EntityIndexAttribute : Attribute
7 | {
8 | public readonly bool IsPrimary;
9 |
10 | public EntityIndexAttribute(bool isPrimary)
11 | {
12 | IsPrimary = isPrimary;
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Entitas.Generators.Attributes/EventAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Generators.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Class, AllowMultiple = true)]
6 | public class EventAttribute : Attribute
7 | {
8 | public readonly EventTarget EventTarget;
9 | public readonly EventType EventType;
10 | public readonly int Order;
11 |
12 | public EventAttribute(EventTarget eventTarget, EventType eventType = EventType.Added, int order = 0)
13 | {
14 | EventTarget = eventTarget;
15 | EventType = eventType;
16 | Order = order;
17 | }
18 | }
19 |
20 | public enum EventTarget
21 | {
22 | Any,
23 | Self
24 | }
25 |
26 | public enum EventType
27 | {
28 | Added,
29 | Removed
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/src/Entitas.Generators.Attributes/UniqueAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Generators.Attributes
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class UniqueAttribute : Attribute { }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/DefaultInstanceCreator/DefaultArrayCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Unity.Editor
4 | {
5 | public class DefaultArrayCreator : IDefaultInstanceCreator
6 | {
7 | public bool HandlesType(Type type) => type.IsArray;
8 |
9 | public object CreateDefault(Type type) =>
10 | Array.CreateInstance(type.GetElementType(), new int[type.GetArrayRank()]);
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/DefaultInstanceCreator/DefaultStringCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Unity.Editor
4 | {
5 | public class DefaultStringCreator : IDefaultInstanceCreator
6 | {
7 | public bool HandlesType(Type type) => type == typeof(string);
8 |
9 | public object CreateDefault(Type type) => string.Empty;
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/DefaultInstanceCreator/IDefaultInstanceCreator.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Unity.Editor
4 | {
5 | public interface IDefaultInstanceCreator
6 | {
7 | bool HandlesType(Type type);
8 |
9 | object CreateDefault(Type type);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Entitas.Unity.Editor.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultTargetFramework)
5 | 2.0.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Entitas.Unity.Editor.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/EntityEditor.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | [CustomEditor(typeof(EntityBehaviour)), CanEditMultipleObjects]
7 | public class EntityEditor : UnityEditor.Editor
8 | {
9 | public override void OnInspectorGUI()
10 | {
11 | if (targets.Length == 1)
12 | {
13 | EntityDrawer.DrawEntity(((EntityBehaviour)target).Entity);
14 | }
15 | else
16 | {
17 | var entities = targets
18 | .Select(t => ((EntityBehaviour)t).Entity)
19 | .ToArray();
20 |
21 | EntityDrawer.DrawMultipleEntities(entities);
22 | }
23 |
24 | if (target != null)
25 | EditorUtility.SetDirty(target);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/EntityLinkEditor.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | [CustomEditor(typeof(EntityLink))]
8 | public class EntityLinkEditor : UnityEditor.Editor
9 | {
10 | public override void OnInspectorGUI()
11 | {
12 | var link = (EntityLink)target;
13 |
14 | if (link.Entity != null)
15 | if (GUILayout.Button("Unlink"))
16 | link.Unlink();
17 |
18 | if (link.Entity != null)
19 | {
20 | EditorGUILayout.Space();
21 |
22 | EditorGUILayout.LabelField(link.Entity.ToString());
23 |
24 | if (GUILayout.Button("Show entity"))
25 | Selection.activeGameObject = FindObjectsOfType()
26 | .Single(entity => entity.Entity == link.Entity).gameObject;
27 |
28 | EditorGUILayout.Space();
29 |
30 | EntityDrawer.DrawEntity(link.Entity);
31 | }
32 | else
33 | {
34 | EditorGUILayout.LabelField("Not linked to an entity");
35 | }
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/IComponentDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Unity.Editor
4 | {
5 | public interface IComponentDrawer
6 | {
7 | bool HandlesType(Type type);
8 |
9 | IComponent DrawComponent(IComponent component);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasContextErrorHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasContextErrorHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasContextHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasContextHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasEntityErrorHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasEntityErrorHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasEntityHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasEntityHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasEntityLinkHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasEntityLinkHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasEntityLinkWarnHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasEntityLinkWarnHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasHeader.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasHeader.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasSystemsHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasSystemsHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/Images/EntitasSystemsWarnHierarchyIcon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/src/Entitas.Unity.Editor/Images/EntitasSystemsWarnHierarchyIcon.png
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/AnimationCurveTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | public class AnimationCurveTypeDrawer : ITypeDrawer
8 | {
9 | public bool HandlesType(Type type) => type == typeof(AnimationCurve);
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
12 | EditorGUILayout.CurveField(memberName, (AnimationCurve)value);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/BoolTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class BoolTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(bool);
9 |
10 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
11 | EditorGUILayout.Toggle(memberName, (bool)value);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/BoundsTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | public class BoundsTypeDrawer : ITypeDrawer
8 | {
9 | public bool HandlesType(Type type) => type == typeof(Bounds);
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
12 | EditorGUILayout.BoundsField(memberName, (Bounds)value);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/CharTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class CharTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(char);
9 |
10 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target)
11 | {
12 | var str = EditorGUILayout.TextField(memberName, ((char)value).ToString());
13 | return str.Length > 0
14 | ? str[0]
15 | : default;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/ColorTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | public class ColorTypeDrawer : ITypeDrawer
8 | {
9 | public bool HandlesType(Type type) => type == typeof(Color);
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
12 | EditorGUILayout.ColorField(memberName, (Color)value);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/DateTimeTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class DateTimeTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(DateTime);
9 |
10 | // Note: This is a very basic implementation. The ToString() method conversion will cut off milliseconds.
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target)
12 | {
13 | var dateString = value.ToString();
14 | var newDateString = EditorGUILayout.TextField(memberName, dateString);
15 | return newDateString != dateString
16 | ? DateTime.Parse(newDateString)
17 | : value;
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/DoubleTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class DoubleTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(double);
9 |
10 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
11 | EditorGUILayout.DoubleField(memberName, (double)value);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/EnumTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class EnumTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type.IsEnum;
9 |
10 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
11 | memberType.IsDefined(typeof(FlagsAttribute), false)
12 | ? EditorGUILayout.EnumFlagsField(memberName, (Enum)value)
13 | : EditorGUILayout.EnumPopup(memberName, (Enum)value);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/FloatTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class FloatTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(float);
9 |
10 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
11 | EditorGUILayout.FloatField(memberName, (float)value);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/ITypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Unity.Editor
4 | {
5 | public interface ITypeDrawer
6 | {
7 | bool HandlesType(Type type);
8 |
9 | object DrawAndGetNewValue(Type memberType, string memberName, object value, object target);
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/IntTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class IntTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(int);
9 |
10 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
11 | EditorGUILayout.IntField(memberName, (int)value);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/RectTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | public class RectTypeDrawer : ITypeDrawer
8 | {
9 | public bool HandlesType(Type type) => type == typeof(Rect);
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
12 | EditorGUILayout.RectField(memberName, (Rect)value);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/StringTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class StringTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) => type == typeof(string);
9 |
10 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
11 | EditorGUILayout.DelayedTextField(memberName, (string)value);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/UnityObjectTypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 |
4 | namespace Entitas.Unity.Editor
5 | {
6 | public class UnityObjectTypeDrawer : ITypeDrawer
7 | {
8 | public bool HandlesType(Type type) =>
9 | type == typeof(UnityEngine.Object) ||
10 | type.IsSubclassOf(typeof(UnityEngine.Object));
11 |
12 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
13 | EditorGUILayout.ObjectField(memberName, (UnityEngine.Object)value, memberType, true);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/Vector2TypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | public class Vector2TypeDrawer : ITypeDrawer
8 | {
9 | public bool HandlesType(Type type) => type == typeof(Vector2);
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
12 | EditorGUILayout.Vector2Field(memberName, (Vector2)value);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/Vector3TypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | public class Vector3TypeDrawer : ITypeDrawer
8 | {
9 | public bool HandlesType(Type type) => type == typeof(Vector3);
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
12 | EditorGUILayout.Vector3Field(memberName, (Vector3)value);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas.Unity.Editor/TypeDrawer/Vector4TypeDrawer.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using UnityEditor;
3 | using UnityEngine;
4 |
5 | namespace Entitas.Unity.Editor
6 | {
7 | public class Vector4TypeDrawer : ITypeDrawer
8 | {
9 | public bool HandlesType(Type type) => type == typeof(Vector4);
10 |
11 | public object DrawAndGetNewValue(Type memberType, string memberName, object value, object target) =>
12 | EditorGUILayout.Vector4Field(memberName, (Vector4)value);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas.Unity/ContextObserver/ContextObserverExtension.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace Entitas.Unity
4 | {
5 | public static class ContextObserverExtension
6 | {
7 | #if !UNITY_EDITOR || ENTITAS_DISABLE_VISUAL_DEBUGGING
8 | [System.Diagnostics.Conditional("false")]
9 | #endif
10 | public static void CreateContextObserver(this IContext context)
11 | {
12 | var contextObserver = new GameObject().AddComponent();
13 | contextObserver.Initialize(context);
14 | Object.DontDestroyOnLoad(contextObserver.gameObject);
15 | }
16 |
17 | public static ContextObserverBehaviour FindContextObserver(this IContext context)
18 | {
19 | foreach (var observer in Object.FindObjectsOfType())
20 | if (observer.Context == context)
21 | return observer;
22 |
23 | return null;
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/src/Entitas.Unity/DebugSystems/AvgResetInterval.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas.Unity
2 | {
3 | public enum AvgResetInterval
4 | {
5 | Always = 1,
6 | VeryFast = 30,
7 | Fast = 60,
8 | Normal = 120,
9 | Slow = 300,
10 | Never = int.MaxValue
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Entitas.Unity/DebugSystems/DebugSystemsBehaviour.cs:
--------------------------------------------------------------------------------
1 | using UnityEngine;
2 |
3 | namespace Entitas.Unity
4 | {
5 | public class DebugSystemsBehaviour : MonoBehaviour
6 | {
7 | public DebugSystems Systems => _systems;
8 |
9 | DebugSystems _systems;
10 |
11 | public void Initialize(DebugSystems systems)
12 | {
13 | _systems = systems;
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/src/Entitas.Unity/DebugSystems/SystemInterfaceFlags.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Unity
4 | {
5 | [Flags]
6 | public enum SystemInterfaceFlags
7 | {
8 | None = 0,
9 | InitializeSystem = 1 << 1,
10 | ExecuteSystem = 1 << 2,
11 | CleanupSystem = 1 << 3,
12 | TearDownSystem = 1 << 4,
13 | ReactiveSystem = 1 << 5
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/src/Entitas.Unity/Entitas.Unity.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultTargetFramework)
5 | 2.0.0
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/src/Entitas.Unity/Entitas.Unity.csproj.DotSettings:
--------------------------------------------------------------------------------
1 |
2 | True
3 | True
4 | True
--------------------------------------------------------------------------------
/src/Entitas.Unity/Entity/DontDrawComponentAttribute.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas.Unity
4 | {
5 | [AttributeUsage(AttributeTargets.Class)]
6 | public class DontDrawComponentAttribute : Attribute { }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Entitas/Collector/CollectorContextExtension.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public static class CollectorContextExtension
4 | {
5 | /// Creates a Collector.
6 | public static ICollector CreateCollector(
7 | this IContext context, IMatcher matcher) where TEntity : Entity
8 | {
9 | return context.CreateCollector(new TriggerOnEvent(matcher, GroupEvent.Added));
10 | }
11 |
12 | /// Creates a Collector.
13 | public static ICollector CreateCollector(
14 | this IContext context, params TriggerOnEvent[] triggers) where TEntity : Entity
15 | {
16 | var groups = new IGroup[triggers.Length];
17 | var groupEvents = new GroupEvent[triggers.Length];
18 |
19 | for (var i = 0; i < triggers.Length; i++)
20 | {
21 | groups[i] = context.GetGroup(triggers[i].Matcher);
22 | groupEvents[i] = triggers[i].GroupEvent;
23 | }
24 |
25 | return new Collector(groups, groupEvents);
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/src/Entitas/Collector/CollectorException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class CollectorException : EntitasException
4 | {
5 | public CollectorException(string message, string hint) : base(message, hint) { }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Entitas/Collector/ICollector.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Entitas
4 | {
5 | public interface ICollector
6 | {
7 | int Count { get; }
8 |
9 | void Activate();
10 | void Deactivate();
11 | void ClearCollectedEntities();
12 | }
13 |
14 | public interface ICollector : ICollector where TEntity : Entity
15 | {
16 | HashSet CollectedEntities { get; }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Entitas/Collector/TriggerOnEvent.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public struct TriggerOnEvent where TEntity : Entity
4 | {
5 | public readonly IMatcher Matcher;
6 | public readonly GroupEvent GroupEvent;
7 |
8 | public TriggerOnEvent(IMatcher matcher, GroupEvent groupEvent)
9 | {
10 | Matcher = matcher;
11 | GroupEvent = groupEvent;
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas/Collector/TriggerOnEventMatcherExtension.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public static class TriggerOnEventMatcherExtension
4 | {
5 | public static TriggerOnEvent Added(this IMatcher matcher) where TEntity : Entity =>
6 | new TriggerOnEvent(matcher, GroupEvent.Added);
7 |
8 | public static TriggerOnEvent Removed(this IMatcher matcher) where TEntity : Entity =>
9 | new TriggerOnEvent(matcher, GroupEvent.Removed);
10 |
11 | public static TriggerOnEvent AddedOrRemoved(this IMatcher matcher) where TEntity : Entity =>
12 | new TriggerOnEvent(matcher, GroupEvent.AddedOrRemoved);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas/Context/ContextInfo.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas
4 | {
5 | public class ContextInfo
6 | {
7 | public readonly string Name;
8 | public readonly string[] ComponentNames;
9 | public readonly Type[] ComponentTypes;
10 |
11 | public ContextInfo(string name, string[] componentNames, Type[] componentTypes)
12 | {
13 | Name = name;
14 | ComponentNames = componentNames;
15 | ComponentTypes = componentTypes;
16 | }
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Entitas/Context/Exceptions/ContextDoesNotContainEntityException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class ContextDoesNotContainEntityException : EntitasException
4 | {
5 | public ContextDoesNotContainEntityException(string message, string hint) :
6 | base($"{message}\nContext does not contain entity!", hint) { }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Entitas/Context/Exceptions/ContextEntityIndexDoesAlreadyExistException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class ContextEntityIndexDoesAlreadyExistException : EntitasException
4 | {
5 | public ContextEntityIndexDoesAlreadyExistException(IContext context, string name) :
6 | base($"Cannot add EntityIndex '{name}' to context '{context}'!",
7 | "An EntityIndex with this name has already been added.") { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Context/Exceptions/ContextEntityIndexDoesNotExistException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class ContextEntityIndexDoesNotExistException : EntitasException
4 | {
5 | public ContextEntityIndexDoesNotExistException(IContext context, string name) :
6 | base($"Cannot get EntityIndex '{name}' from context '{context}'!",
7 | "No EntityIndex with this name has been added.") { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Context/Exceptions/ContextInfoException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class ContextInfoException : EntitasException
4 | {
5 | public ContextInfoException(IContext context, ContextInfo contextInfo) :
6 | base($"Invalid ContextInfo for '{context}'!\nExpected {context.TotalComponents} ComponentName(s) but got {contextInfo.ComponentNames.Length}:",
7 | string.Join("\n", contextInfo.ComponentNames)) { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Context/Exceptions/ContextStillHasRetainedEntitiesException.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using System.Linq;
3 |
4 | namespace Entitas
5 | {
6 | public class ContextStillHasRetainedEntitiesException : EntitasException
7 | {
8 | public ContextStillHasRetainedEntitiesException(IContext context, IEnumerable entities) :
9 | base($"'{context}' detected retained entities although all entities got destroyed!",
10 | $"Did you release all entities? Try calling systems.DeactivateReactiveSystems() before calling context.DestroyAllEntities() to avoid memory leaks. Do not forget to activate them back when needed.\n{EntitiesToString(entities)}") { }
11 |
12 | static string EntitiesToString(IEnumerable entities) =>
13 | string.Join("\n", entities.Select(entity => entity.Aerc is SafeAERC safeAerc
14 | ? $"{entity} - {string.Join(", ", safeAerc.Owners.Select(o => o.ToString()))}"
15 | : entity.ToString())
16 | );
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/src/Entitas/Context/Exceptions/EntityIsNotDestroyedException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class EntityIsNotDestroyedException : EntitasException
4 | {
5 | public EntityIsNotDestroyedException(string message) :
6 | base($"{message}\nEntity is not destroyed yet!",
7 | "Did you manually call entity.Release(context) yourself? If so, please don\'t :)") { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Entitas.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultTargetFramework)
5 | 2.0.0
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/src/Entitas/EntitasException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas
4 | {
5 | /// Base exception used by Entitas.
6 | public class EntitasException : Exception
7 | {
8 | public EntitasException(string message, string hint) :
9 | base(hint != null ? $"{message}\n{hint}" : message) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/EntityEqualityComparer.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 |
3 | namespace Entitas
4 | {
5 | public class EntityEqualityComparer : IEqualityComparer where TEntity : Entity
6 | {
7 | public static readonly IEqualityComparer Comparer = new EntityEqualityComparer();
8 |
9 | public bool Equals(TEntity x, TEntity y) => x == y;
10 |
11 | public int GetHashCode(TEntity obj) => obj.Id;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/Exceptions/EntityAlreadyHasComponentException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class EntityAlreadyHasComponentException : EntitasException
4 | {
5 | public EntityAlreadyHasComponentException(int index, string message, string hint) :
6 | base($"{message}\nEntity already has a component at index {index}!", hint) { }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/Exceptions/EntityDoesNotHaveComponentException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class EntityDoesNotHaveComponentException : EntitasException
4 | {
5 | public EntityDoesNotHaveComponentException(int index, string message, string hint) :
6 | base($"{message}\nEntity does not have a component at index {index}!", hint) { }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/Exceptions/EntityIsAlreadyRetainedByOwnerException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class EntityIsAlreadyRetainedByOwnerException : EntitasException
4 | {
5 | public EntityIsAlreadyRetainedByOwnerException(Entity entity, object owner) :
6 | base($"'{owner}' cannot retain {entity}!\nEntity is already retained by this object!",
7 | "The entity must be released by this object first.") { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/Exceptions/EntityIsNotEnabledException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class EntityIsNotEnabledException : EntitasException
4 | {
5 | public EntityIsNotEnabledException(string message) :
6 | base($"{message}\nEntity is not enabled!",
7 | "The entity has already been destroyed. You cannot modify destroyed entities.") { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/Exceptions/EntityIsNotRetainedByOwnerException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class EntityIsNotRetainedByOwnerException : EntitasException
4 | {
5 | public EntityIsNotRetainedByOwnerException(Entity entity, object owner) :
6 | base($"'{owner}' cannot release {entity}!\nEntity is not retained by this object!",
7 | "An entity can only be released from objects that retain it.") { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/IAERC.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface IAERC
4 | {
5 | int RetainCount { get; }
6 | void Retain(object owner);
7 | void Release(object owner);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Entity/UnsafeAERC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas
4 | {
5 | /// Automatic Entity Reference Counting (AERC)
6 | /// is used internally to prevent pooling retained entities.
7 | /// If you use retain manually you also have to
8 | /// release it manually at some point.
9 | /// UnsafeAERC doesn't check if the entity has already been
10 | /// retained or released. It's faster than SafeAERC, but you lose the information
11 | /// about the owners.
12 | public sealed class UnsafeAERC : IAERC
13 | {
14 | public static readonly Func Delegate = entity => new UnsafeAERC();
15 |
16 | public int RetainCount => _retainCount;
17 |
18 | int _retainCount;
19 |
20 | public void Retain(object owner) => _retainCount += 1;
21 |
22 | public void Release(object owner) => _retainCount -= 1;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/src/Entitas/EntityIndex/EntityIndexException.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public class EntityIndexException : EntitasException
4 | {
5 | public EntityIndexException(string message, string hint) : base(message, hint) { }
6 | }
7 | }
8 |
--------------------------------------------------------------------------------
/src/Entitas/EntityIndex/IEntityIndex.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface IEntityIndex
4 | {
5 | string Name { get; }
6 |
7 | void Activate();
8 | void Deactivate();
9 | }
10 | }
11 |
--------------------------------------------------------------------------------
/src/Entitas/Extensions/EntitasStringExtension.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public static class EntitasStringExtension
4 | {
5 | public static string RemoveSuffix(this string str, string suffix)
6 | {
7 | return str.EndsWith(suffix, System.StringComparison.Ordinal)
8 | ? str.Substring(0, str.Length - suffix.Length)
9 | : str;
10 | }
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/src/Entitas/Group/GroupEvent.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public enum GroupEvent : byte
4 | {
5 | Added,
6 | Removed,
7 | AddedOrRemoved
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Group/GroupExtension.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public static class GroupExtension
4 | {
5 | /// Creates a Collector for this group.
6 | public static ICollector CreateCollector(this IGroup group, GroupEvent groupEvent = GroupEvent.Added) where TEntity : Entity =>
7 | new Collector(group, groupEvent);
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Group/GroupSingleEntityException.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace Entitas
4 | {
5 | public class GroupSingleEntityException : EntitasException where TEntity : Entity
6 | {
7 | public GroupSingleEntityException(IGroup group) :
8 | base($"Cannot get the single entity from {group}!\nGroup contains {group.Count} entities:",
9 | string.Join("\n", group.GetEntities().Select(entity => entity.ToString()))) { }
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/src/Entitas/IComponent.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | /// Implement this interface if you want to create a component which
4 | /// you can add to an entity.
5 | /// Mandatory attributes from Entitas.Generators.Attributes:
6 | /// [Context(typeof(MainContext))]: Use the context attribute to make this
7 | /// component available in the specified context.
8 | /// Optionally, you can add these attributes:
9 | /// [Unique]: the code generator will generate additional methods for
10 | /// the context to ensure that only one entity with this component exists.
11 | /// E.g. context.AddLoading() or context.SetPlayerName(name);
12 | /// More available attributes can be found in Entitas.Generators.Attributes.
13 | public interface IComponent { }
14 | }
15 |
--------------------------------------------------------------------------------
/src/Entitas/Matcher/Interfaces/IAllOfMatcher.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface IAllOfMatcher : IAnyOfMatcher where TEntity : Entity
4 | {
5 | IAnyOfMatcher AnyOf(params int[] indexes);
6 | IAnyOfMatcher AnyOf(params IMatcher[] matchers);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Entitas/Matcher/Interfaces/IAnyOfMatcher.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface IAnyOfMatcher : INoneOfMatcher where TEntity : Entity
4 | {
5 | INoneOfMatcher NoneOf(params int[] indexes);
6 | INoneOfMatcher NoneOf(params IMatcher[] matchers);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Entitas/Matcher/Interfaces/ICompoundMatcher.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface ICompoundMatcher : IMatcher where TEntity : Entity
4 | {
5 | int[] AllOfIndexes { get; }
6 | int[] AnyOfIndexes { get; }
7 | int[] NoneOfIndexes { get; }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Matcher/Interfaces/IMatcher.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface IMatcher where TEntity : Entity
4 | {
5 | int[] Indexes { get; }
6 | bool Matches(TEntity entity);
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Entitas/Matcher/Interfaces/INoneOfMatcher.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface INoneOfMatcher : ICompoundMatcher where TEntity : Entity { }
4 | }
5 |
--------------------------------------------------------------------------------
/src/Entitas/Matcher/MatcherException.cs:
--------------------------------------------------------------------------------
1 | using System;
2 |
3 | namespace Entitas
4 | {
5 | public class MatcherException : Exception
6 | {
7 | public MatcherException(int indexes) : base($"Matcher.Indexes.Length must be 1 but was {indexes}") { }
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Systems/Interfaces/ICleanupSystem.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | /// Implement this interface if you want to create a system which should
4 | /// execute cleanup logic after execution.
5 | public interface ICleanupSystem : ISystem
6 | {
7 | void Cleanup();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Systems/Interfaces/IExecuteSystem.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | /// Implement this interface if you want to create a system which should be
4 | /// executed every frame.
5 | public interface IExecuteSystem : ISystem
6 | {
7 | void Execute();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Systems/Interfaces/IInitializeSystem.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | /// Implement this interface if you want to create a system which should be
4 | /// initialized once in the beginning.
5 | public interface IInitializeSystem : ISystem
6 | {
7 | void Initialize();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Systems/Interfaces/IReactiveSystem.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | public interface IReactiveSystem : IExecuteSystem
4 | {
5 | void Activate();
6 | void Deactivate();
7 | void Clear();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Systems/Interfaces/ISystem.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | /// This is the base interface for all systems.
4 | /// It's not meant to be implemented.
5 | /// Use IInitializeSystem, IExecuteSystem,
6 | /// ICleanupSystem or ITearDownSystem.
7 | public interface ISystem { }
8 | }
9 |
--------------------------------------------------------------------------------
/src/Entitas/Systems/Interfaces/ITearDownSystem.cs:
--------------------------------------------------------------------------------
1 | namespace Entitas
2 | {
3 | /// Implement this interface if you want to create a system which should
4 | /// tear down once in the end.
5 | public interface ITearDownSystem : ISystem
6 | {
7 | void TearDown();
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/src/Entitas/Systems/ParallelSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Linq;
2 |
3 | namespace Entitas
4 | {
5 | /// A ParallelSystem calls Execute(entities) with subsets of entities
6 | /// and distributes the workload over multiple threads.
7 | /// Don't use the generated methods like AddXyz() and ReplaceXyz() when
8 | /// writing multi-threaded code in Entitas.
9 | public abstract class ParallelSystem : IExecuteSystem where TEntity : Entity
10 | {
11 | readonly IGroup _group;
12 |
13 | protected ParallelSystem(IGroup group)
14 | {
15 | _group = group;
16 | }
17 |
18 | public virtual void Execute()
19 | {
20 | _group
21 | .GetEntities()
22 | .AsParallel()
23 | .ForAll(Execute);
24 | }
25 |
26 | protected abstract void Execute(TEntity entity);
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/CleanupSystemTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using MyApp;
3 | using MyFeature;
4 | using Xunit;
5 |
6 | namespace Entitas.Generators.IntegrationTests
7 | {
8 | public class CleanupSystemTests
9 | {
10 | readonly MainContext _context;
11 |
12 | public CleanupSystemTests()
13 | {
14 | ContextInitialization.InitializeMain();
15 | _context = new MainContext();
16 | }
17 |
18 | [Fact]
19 | public void RemovesComponent()
20 | {
21 | var system = new RemoveMyAppMainUserCleanupSystem(_context);
22 | var entity = _context.CreateEntity().AddUser("Test", 42);
23 | system.Cleanup();
24 | entity.HasUser().Should().BeFalse();
25 | entity.IsEnabled.Should().BeTrue();
26 | }
27 |
28 | [Fact]
29 | public void DestroysEntity()
30 | {
31 | var system = new DestroyMyAppMainLoadingCleanupSystem(_context);
32 | var entity = _context.CreateEntity().AddLoading();
33 | system.Cleanup();
34 | entity.HasLoading().Should().BeFalse();
35 | entity.IsEnabled.Should().BeFalse();
36 | }
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/CleanupSystemsTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using MyApp;
3 | using Xunit;
4 |
5 | namespace Entitas.Generators.IntegrationTests
6 | {
7 | public class CleanupSystemsTests
8 | {
9 | [Fact]
10 | public void GeneratesCleanupSystems()
11 | {
12 | ContextInitialization.InitializeMain();
13 | new MainContext().CreateCleanupSystems().Should().NotBeNull();
14 | }
15 |
16 | [Fact]
17 | public void GeneratesEmptyCleanupSystems()
18 | {
19 | ContextInitialization.InitializeEmpty();
20 | new EmptyContext().CreateCleanupSystems().Should().BeNull();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/ComponentIndexTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using Xunit;
3 |
4 | namespace Entitas.Generators.IntegrationTests
5 | {
6 | public class ComponentIndexTests
7 | {
8 | [Fact]
9 | public void GeneratesComponentIndex()
10 | {
11 | new MyApp.Main.ComponentIndex(1).Value.Should().Be(1);
12 | }
13 |
14 | [Fact]
15 | public void EqualsComponentIndexWithSameIndex()
16 | {
17 | new MyApp.Main.ComponentIndex(1).Equals(new MyApp.Main.ComponentIndex(1)).Should().BeTrue();
18 | }
19 |
20 | [Fact]
21 | public void DoesNotEqualComponentIndexWithDifferentIndex()
22 | {
23 | new MyApp.Main.ComponentIndex(1).Equals(new MyApp.Main.ComponentIndex(2)).Should().BeFalse();
24 | }
25 | }
26 | }
27 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/ContextInitialization.cs:
--------------------------------------------------------------------------------
1 | using Entitas.Generators.Attributes;
2 |
3 | namespace MyApp
4 | {
5 | public static partial class ContextInitialization
6 | {
7 | [ContextInitialization(typeof(MainContext))]
8 | public static partial void InitializeMain();
9 |
10 | [ContextInitialization(typeof(EmptyContext))]
11 | public static partial void InitializeEmpty();
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/ContextTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using MyApp;
3 | using Xunit;
4 |
5 | namespace Entitas.Generators.IntegrationTests
6 | {
7 | public class ContextTests
8 | {
9 | public ContextTests()
10 | {
11 | ContextInitialization.InitializeMain();
12 | }
13 |
14 | [Fact]
15 | public void GeneratesContext()
16 | {
17 | var context = new MainContext();
18 | context.Should().NotBeNull();
19 | context.Should().BeAssignableTo>();
20 | }
21 |
22 | [Fact]
23 | public void CreatesEntity()
24 | {
25 | var context = new MainContext();
26 | var entity = context.CreateEntity();
27 | entity.Should().NotBeNull();
28 | entity.Should().BeAssignableTo();
29 | entity.TotalComponents.Should().Be(context.TotalComponents);
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/EntityIndexTests.cs:
--------------------------------------------------------------------------------
1 | using MyApp;
2 | using Xunit;
3 |
4 | namespace Entitas.Generators.IntegrationTests
5 | {
6 | public class EntityIndexTests
7 | {
8 | [Fact]
9 | public void GeneratesEventSystems()
10 | {
11 | ContextInitialization.InitializeMain();
12 | new MainContext().AddAllEntityIndexes();
13 | }
14 |
15 | [Fact]
16 | public void GeneratesEmptyEventSystems()
17 | {
18 | ContextInitialization.InitializeEmpty();
19 | new EmptyContext().AddAllEntityIndexes();
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/EntityTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using Xunit;
3 |
4 | namespace Entitas.Generators.IntegrationTests
5 | {
6 | public class EntityTests
7 | {
8 | [Fact]
9 | public void GeneratesEntity()
10 | {
11 | var entity = new MyApp.Main.Entity();
12 | entity.Should().NotBeNull();
13 | entity.Should().BeAssignableTo();
14 | }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/EventSystemsTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using MyApp;
3 | using Xunit;
4 |
5 | namespace Entitas.Generators.IntegrationTests
6 | {
7 | public class EventSystemsTests
8 | {
9 | [Fact]
10 | public void GeneratesEventSystems()
11 | {
12 | ContextInitialization.InitializeMain();
13 | new MainContext().CreateEventSystems().Should().NotBeNull();
14 | }
15 |
16 | [Fact]
17 | public void GeneratesEmptyEventSystems()
18 | {
19 | ContextInitialization.InitializeEmpty();
20 | new EmptyContext().CreateEventSystems().Should().BeNull();
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/fixtures/EmptyContext.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | namespace MyApp
4 | {
5 | partial class EmptyContext : IContext { }
6 | }
7 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/fixtures/LoadingComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using MyApp;
4 |
5 | namespace MyFeature
6 | {
7 | [Context(typeof(MainContext)), Context(typeof(OtherContext))]
8 | [Unique]
9 | [Event(EventTarget.Any, EventType.Added, 1)]
10 | [Event(EventTarget.Any, EventType.Removed, 2)]
11 | [Event(EventTarget.Self, EventType.Added, 3)]
12 | [Event(EventTarget.Self, EventType.Removed, 4)]
13 | [Cleanup(CleanupMode.DestroyEntity)]
14 | public sealed class LoadingComponent : IComponent { }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/fixtures/MainContext.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | namespace MyApp
4 | {
5 | partial class MainContext : IContext { }
6 | }
7 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/fixtures/OtherContext.cs:
--------------------------------------------------------------------------------
1 | partial class OtherContext : Entitas.IContext { }
2 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.IntegrationTests/fixtures/UserComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext)), Context(typeof(OtherContext))]
10 | [Unique]
11 | [Event(EventTarget.Any, EventType.Added, 1)]
12 | [Event(EventTarget.Any, EventType.Removed, 2)]
13 | [Event(EventTarget.Self, EventType.Added, 3)]
14 | [Event(EventTarget.Self, EventType.Removed, 4)]
15 | [Cleanup(CleanupMode.RemoveComponent)]
16 | public sealed class UserComponent : IComponent
17 | {
18 | [EntityIndex(true)]
19 | public string Name;
20 |
21 | [EntityIndex(false)]
22 | public int Age;
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests.Fixtures.Dependencies/CollisionComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using MyApp;
4 |
5 | namespace MyOtherFeature
6 | {
7 | [Context(typeof(LibraryContext))]
8 | [Event(EventTarget.Self, EventType.Added, 1)]
9 | public class CollisionComponent : IComponent
10 | {
11 | public int Value;
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests.Fixtures.Dependencies/ContextInitialization.cs:
--------------------------------------------------------------------------------
1 | using Entitas.Generators.Attributes;
2 |
3 | namespace MyApp.Library
4 | {
5 | public static partial class ContextInitialization
6 | {
7 | [ContextInitialization(typeof(LibraryContext))]
8 | public static partial void InitializeMain();
9 | }
10 | }
11 |
12 | namespace MyApp.Library
13 | {
14 | public static partial class ContextInitialization
15 | {
16 | public static partial void InitializeMain()
17 | {
18 | MyApp.LibraryContext.ComponentNames = new string[] { };
19 |
20 | MyApp.LibraryContext.ComponentTypes = new global::System.Type[] { };
21 | }
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests.Fixtures.Dependencies/Entitas.Generators.Tests.Fixtures.Dependencies.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultTargetFramework)
5 | false
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests.Fixtures.Dependencies/HealthComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using MyApp;
4 |
5 | namespace MyOtherFeature
6 | {
7 | [Context(typeof(LibraryContext))]
8 | public class HealthComponent : IComponent
9 | {
10 | public int Value;
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests.Fixtures.Dependencies/LibraryContext.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | namespace MyApp
4 | {
5 | partial class LibraryContext : IContext { }
6 | }
7 |
8 | namespace MyApp
9 | {
10 | public sealed partial class LibraryContext : global::Entitas.Context
11 | {
12 | public static string[] ComponentNames;
13 | public static global::System.Type[] ComponentTypes;
14 |
15 | public LibraryContext() :
16 | base(
17 | ComponentTypes.Length,
18 | 0,
19 | new global::Entitas.ContextInfo(
20 | "MyApp.LibraryContext",
21 | ComponentNames,
22 | ComponentTypes
23 | ),
24 | entity =>
25 | #if (ENTITAS_FAST_AND_UNSAFE)
26 | new global::Entitas.UnsafeAERC(),
27 | #else
28 | new global::Entitas.SafeAERC(entity),
29 | #endif
30 | () => new Library.Entity()
31 | ) { }
32 | }
33 | }
34 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests.Fixtures.Dependencies/MyApp.Library.Entity.cs:
--------------------------------------------------------------------------------
1 | namespace MyApp.Library
2 | {
3 | public sealed class Entity : global::Entitas.Entity { }
4 | }
5 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/ModuleInitializer.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.CompilerServices;
2 | using VerifyTests;
3 |
4 | namespace Entitas.Generators.Tests
5 | {
6 | public static class ModuleInitializer
7 | {
8 | [ModuleInitializer]
9 | public static void Init()
10 | {
11 | VerifySourceGenerators.Initialize();
12 | }
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/CleanupDestroyEntityComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext)), Cleanup(CleanupMode.DestroyEntity)]
8 | public sealed class CleanupDestroyEntityComponent : IComponent { }
9 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/CleanupDestroyEntityNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext)), Cleanup(CleanupMode.DestroyEntity)]
10 | public sealed class CleanupDestroyEntityNamespacedComponent : IComponent { }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/CleanupRemoveComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext)), Cleanup(CleanupMode.RemoveComponent)]
8 | public sealed class CleanupRemoveComponent : IComponent { }
9 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/CleanupRemoveNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext)), Cleanup(CleanupMode.RemoveComponent)]
10 | public sealed class CleanupRemoveNamespacedComponent : IComponent { }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/ComplexTypesComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using System.Collections.Generic;
4 | using Entitas;
5 | using Entitas.Generators.Attributes;
6 | using MyApp;
7 |
8 | namespace MyFeature
9 | {
10 | [Context(typeof(MainContext))]
11 | public sealed class ComplexTypesComponent : IComponent
12 | {
13 | public int[,,] Array3D;
14 | public Dictionary> DictList;
15 | public NestedClass.InnerClass NestedClass;
16 | public NestedClass.InnerEnum NestedEnum;
17 | }
18 |
19 | public class NestedClass
20 | {
21 | public class InnerClass { }
22 |
23 | public enum InnerEnum
24 | {
25 | A,
26 | B,
27 | C
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/ContextFromDifferentAssemblyNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(LibraryContext))]
10 | public sealed class ContextFromDifferentAssemblyNamespacedComponent : IComponent { }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/DuplicatedContextsNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | [Context(typeof(MainContext))]
11 | public sealed class DuplicatedContextsNamespacedComponent : IComponent { }
12 | }
13 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/EntityIndexComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext))]
8 | public sealed class EntityIndexComponent : IComponent
9 | {
10 | [EntityIndex(false)]
11 | public string Value;
12 | }
13 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/EntityIndexNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | public sealed class EntityIndexNamespacedComponent : IComponent
11 | {
12 | [EntityIndex(false)]
13 | public string Value;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/EventComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext))]
8 | [Event(EventTarget.Any, EventType.Added, 1)]
9 | [Event(EventTarget.Any, EventType.Removed, 2)]
10 | [Event(EventTarget.Self, EventType.Added, 3)]
11 | [Event(EventTarget.Self, EventType.Removed, 4)]
12 | public sealed class EventComponent : IComponent
13 | {
14 | public string Value;
15 | }
16 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/EventNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | [Event(EventTarget.Any, EventType.Added, 1)]
11 | [Event(EventTarget.Any, EventType.Removed, 2)]
12 | [Event(EventTarget.Self, EventType.Added, 3)]
13 | [Event(EventTarget.Self, EventType.Removed, 4)]
14 | public sealed class EventNamespacedComponent : IComponent
15 | {
16 | public string Value;
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/FlagEventComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext))]
8 | [Event(EventTarget.Any, EventType.Added, 1)]
9 | [Event(EventTarget.Any, EventType.Removed, 2)]
10 | [Event(EventTarget.Self, EventType.Added, 3)]
11 | [Event(EventTarget.Self, EventType.Removed, 4)]
12 | public sealed class FlagEventComponent : IComponent { }
13 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/FlagEventNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | [Event(EventTarget.Any, EventType.Added, 1)]
11 | [Event(EventTarget.Any, EventType.Removed, 2)]
12 | [Event(EventTarget.Self, EventType.Added, 3)]
13 | [Event(EventTarget.Self, EventType.Removed, 4)]
14 | public sealed class FlagEventNamespacedComponent : IComponent { }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/MultipleFieldsComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext))]
8 | public sealed class MultipleFieldsComponent : IComponent
9 | {
10 | public string Value1;
11 | public string Value2;
12 | public string Value3;
13 | }
14 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/MultipleFieldsNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | public sealed class MultipleFieldsNamespacedComponent : IComponent
11 | {
12 | public string Value1;
13 | public string Value2;
14 | public string Value3;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/MultiplePropertiesNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | public sealed class MultiplePropertiesNamespacedComponent : IComponent
11 | {
12 | public string Value1 { get; set; }
13 | public string Value2 { get; set; }
14 |
15 | public string Value3
16 | {
17 | get => _value3;
18 | set => _value3 = value;
19 | }
20 |
21 | string _value3;
22 | }
23 | }
24 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/NoContextComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 |
5 | namespace MyFeature
6 | {
7 | public sealed class NoContextComponent : IComponent { }
8 | }
9 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/NoValidFieldsNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | #pragma warning disable CS0169
8 |
9 | namespace MyFeature
10 | {
11 | [Context(typeof(MainContext))]
12 | public sealed class NoValidFieldsNamespacedComponent : IComponent
13 | {
14 | public static string PublicStaticField;
15 |
16 | string _privateField;
17 | static string _privateStaticField;
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/NonPublicComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | #pragma warning disable CS0649
8 |
9 | namespace MyFeature
10 | {
11 | [Context(typeof(MainContext))]
12 | class NonPublicComponent : IComponent
13 | {
14 | public string Value;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/OneFieldComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext))]
8 | public sealed class OneFieldComponent : IComponent
9 | {
10 | public string Value;
11 | }
12 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/OneFieldNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | public sealed class OneFieldNamespacedComponent : IComponent
11 | {
12 | public string Value;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/PrimaryEntityIndexComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext))]
8 | public sealed class PrimaryEntityIndexComponent : IComponent
9 | {
10 | [EntityIndex(true)]
11 | public string Value;
12 | }
13 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/PrimaryEntityIndexNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | public sealed class PrimaryEntityIndexNamespacedComponent : IComponent
11 | {
12 | [EntityIndex(true)]
13 | public string Value;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/ReservedKeywordFieldsNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | public sealed class ReservedKeywordFieldsNamespacedComponent : IComponent
11 | {
12 | public string Namespace;
13 | public string Class;
14 | public string Public;
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/SomeComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | [Context(typeof(MainContext))]
8 | public sealed class SomeComponent : IComponent { }
9 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/SomeNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext))]
10 | public sealed class SomeNamespacedComponent : IComponent { }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/UniqueNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext)), Unique]
10 | public sealed class UniqueNamespacedComponent : IComponent { }
11 | }
12 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Components/UniqueOneFieldNamespacedComponent.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 | using Entitas.Generators.Attributes;
5 | using MyApp;
6 |
7 | namespace MyFeature
8 | {
9 | [Context(typeof(MainContext)), Unique]
10 | public sealed class UniqueOneFieldNamespacedComponent : IComponent
11 | {
12 | public string Value;
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Contexts/ContextInitialization.txt:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using MyApp;
4 |
5 | namespace MyFeature
6 | {
7 | [Context(typeof(MainContext))]
8 | public sealed class AnotherNamespacedComponent : IComponent { }
9 | }
10 |
11 | namespace MyApp
12 | {
13 | public static partial class ContextInitialization
14 | {
15 | [ContextInitialization(typeof(MainContext))]
16 | public static partial void Initialize();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Contexts/ContextInitializationFromDifferentAssembly.txt:
--------------------------------------------------------------------------------
1 | using Entitas;
2 | using Entitas.Generators.Attributes;
3 | using MyApp;
4 |
5 | namespace MyFeature
6 | {
7 | [Context(typeof(MainContext))]
8 | public sealed class SomeNamespacedComponent : IComponent { }
9 | }
10 |
11 | namespace MyApp
12 | {
13 | public static partial class ContextInitialization
14 | {
15 | [ContextInitialization(typeof(LibraryContext))]
16 | public static partial void Initialize();
17 | }
18 | }
19 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Contexts/EmptyContextInitialization.txt:
--------------------------------------------------------------------------------
1 | using Entitas.Generators.Attributes;
2 |
3 | namespace MyApp
4 | {
5 | public sealed class NoContextComponent : IComponent { }
6 |
7 | public static partial class ContextInitialization
8 | {
9 | [ContextInitialization(typeof(EmptyContext))]
10 | public static partial void Initialize();
11 | }
12 | }
13 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Contexts/NamespacedContext.txt:
--------------------------------------------------------------------------------
1 | namespace MyApp
2 | {
3 | partial class NamespacedContext : Entitas.IContext { }
4 | }
5 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/Contexts/SomeContext.txt:
--------------------------------------------------------------------------------
1 | partial class SomeContext : Entitas.IContext { }
2 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/FakeGenerated/ContextInitialization.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas.Generators.Attributes;
4 |
5 | namespace MyApp
6 | {
7 | public static partial class ContextInitialization
8 | {
9 | [ContextInitialization(typeof(MainContext))]
10 | public static partial void InitializeMain();
11 | }
12 | }
13 |
14 | namespace MyApp
15 | {
16 | public static partial class ContextInitialization
17 | {
18 | public static partial void InitializeMain()
19 | {
20 | MyApp.MainContext.ComponentNames = new string[] { };
21 |
22 | MyApp.MainContext.ComponentTypes = new global::System.Type[] { };
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/FakeGenerated/MainContext.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | using Entitas;
4 |
5 | namespace MyApp
6 | {
7 | partial class MainContext : IContext { }
8 | }
9 |
10 | namespace MyApp
11 | {
12 | public sealed partial class MainContext : global::Entitas.Context
13 | {
14 | public static string[] ComponentNames;
15 | public static global::System.Type[] ComponentTypes;
16 |
17 | public MainContext() :
18 | base(
19 | ComponentTypes.Length,
20 | 0,
21 | new global::Entitas.ContextInfo(
22 | "MyApp.MainContext",
23 | ComponentNames,
24 | ComponentTypes
25 | ),
26 | entity =>
27 | #if (ENTITAS_FAST_AND_UNSAFE)
28 | new global::Entitas.UnsafeAERC(),
29 | #else
30 | new global::Entitas.SafeAERC(entity),
31 | #endif
32 | () => new Main.Entity()
33 | ) { }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/FakeGenerated/MyApp.Main.Entity.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | namespace MyApp.Main
4 | {
5 | public sealed class Entity : global::Entitas.Entity { }
6 | }
7 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/SomeClass.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | public class SomeClass { }
4 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/fixtures/SomeNamespacedClass.cs:
--------------------------------------------------------------------------------
1 | #nullable disable
2 |
3 | namespace MyApp
4 | {
5 | public class SomeNamespacedClass { }
6 | }
7 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/remove-snapshots.bash:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env bash
2 | set -uo pipefail
3 | IFS=$'\n\t'
4 |
5 | dir=snapshots
6 | files="$(cat snapshots-to-delete.txt)"
7 |
8 | for f in ${files}; do
9 | rm -v "${dir}/${f#*- }"
10 | done
11 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots-to-delete.txt:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/sschmid/Entitas/37547d1bd280f3f1c1ef7edb44f2a206660fbfb4/tests/Entitas.Generators.Tests/snapshots-to-delete.txt
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.CleanupRemoveComponent#RemoveMyAppMainCleanupRemoveCleanupSystem.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: RemoveMyAppMainCleanupRemoveCleanupSystem.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.CleanupSystem
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | public sealed class RemoveMyAppMainCleanupRemoveCleanupSystem : global::Entitas.ICleanupSystem
12 | {
13 | readonly global::Entitas.IGroup _group;
14 | readonly global::System.Collections.Generic.List _buffer = new global::System.Collections.Generic.List();
15 |
16 | public RemoveMyAppMainCleanupRemoveCleanupSystem(global::MyApp.MainContext context)
17 | {
18 | _group = context.GetGroup(MyAppMainCleanupRemoveMatcher.CleanupRemove);
19 | }
20 |
21 | public void Cleanup()
22 | {
23 | foreach (var entity in _group.GetEntities(_buffer))
24 | {
25 | entity.RemoveCleanupRemove();
26 | }
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.CleanupSystems#MyApp.MainContextCleanupSystemsExtension.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyApp.MainContextCleanupSystemsExtension.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.CleanupSystems
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace MyApp
12 | {
13 | public static class MainContextCleanupSystemsExtension
14 | {
15 | public static global::Entitas.Systems CreateCleanupSystems(this MainContext context)
16 | {
17 | var systems = new global::Entitas.Systems();
18 | systems.Add(new global::DestroyMyAppMainCleanupDestroyEntityCleanupSystem(context));
19 | systems.Add(new global::RemoveMyAppMainCleanupRemoveCleanupSystem(context));
20 | systems.Add(new global::MyFeature.DestroyMyAppMainCleanupDestroyEntityNamespacedCleanupSystem(context));
21 | systems.Add(new global::MyFeature.RemoveMyAppMainCleanupRemoveNamespacedCleanupSystem(context));
22 | return systems;
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.Component#MyAppMainSomeComponentIndex.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyAppMainSomeComponentIndex.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.ComponentIndex
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | public static class MyAppMainSomeComponentIndex
12 | {
13 | public static global::MyApp.Main.ComponentIndex Index;
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.Component#MyAppMainSomeMatcher.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyAppMainSomeMatcher.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.Matcher
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | public static class MyAppMainSomeMatcher
12 | {
13 | static global::Entitas.IMatcher _matcher;
14 |
15 | public static global::Entitas.IMatcher Some
16 | {
17 | get
18 | {
19 | if (_matcher == null)
20 | {
21 | var matcher = (global::Entitas.Matcher)global::Entitas.Matcher.AllOf(MyAppMainSomeComponentIndex.Index.Value);
22 | matcher.ComponentNames = MyApp.MainContext.ComponentNames;
23 | _matcher = matcher;
24 | }
25 |
26 | return _matcher;
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.EmptyContextInitialization#MyApp.ContextInitialization.Initialize.ContextInitialization.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyApp.ContextInitialization.Initialize.ContextInitialization.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.ContextInitializationMethod
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace MyApp
12 | {
13 | public static partial class ContextInitialization
14 | {
15 | public static partial void Initialize()
16 | {
17 |
18 |
19 | global::EmptyContext.ComponentNames = new string[]
20 | {
21 |
22 | };
23 |
24 | global::EmptyContext.ComponentTypes = new global::System.Type[]
25 | {
26 |
27 | };
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.NamespacedComponent#MyFeature.MyAppMainSomeNamespacedComponentIndex.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyFeature.MyAppMainSomeNamespacedComponentIndex.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.ComponentIndex
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace MyFeature
12 | {
13 | public static class MyAppMainSomeNamespacedComponentIndex
14 | {
15 | public static global::MyApp.Main.ComponentIndex Index;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.NamespacedComponent#MyFeature.MyAppMainSomeNamespacedMatcher.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyFeature.MyAppMainSomeNamespacedMatcher.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.Matcher
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace MyFeature
12 | {
13 | public static class MyAppMainSomeNamespacedMatcher
14 | {
15 | static global::Entitas.IMatcher _matcher;
16 |
17 | public static global::Entitas.IMatcher SomeNamespaced
18 | {
19 | get
20 | {
21 | if (_matcher == null)
22 | {
23 | var matcher = (global::Entitas.Matcher)global::Entitas.Matcher.AllOf(MyAppMainSomeNamespacedComponentIndex.Index.Value);
24 | matcher.ComponentNames = MyApp.MainContext.ComponentNames;
25 | _matcher = matcher;
26 | }
27 |
28 | return _matcher;
29 | }
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.NoCleanupSystems#EmptyContextCleanupSystemsExtension.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: EmptyContextCleanupSystemsExtension.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.CleanupSystems
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | public static class EmptyContextCleanupSystemsExtension
12 | {
13 | public static global::Entitas.Systems CreateCleanupSystems(this EmptyContext context)
14 | {
15 | return null;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.NoEntityIndexes#EmptyContextEntityIndexExtension.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: EmptyContextEntityIndexExtension.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.EntityIndexExtension
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | public static class EmptyContextEntityIndexExtension
12 | {
13 | public static EmptyContext AddAllEntityIndexes(this EmptyContext context)
14 | {
15 | return context;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ComponentGeneratorTests.NoEventSystems#EmptyContextEventSystemsExtension.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: EmptyContextEventSystemsExtension.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ComponentGenerator.EventSystemsContextExtension
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | public static class EmptyContextEventSystemsExtension
12 | {
13 | public static global::Entitas.Systems CreateEventSystems(this EmptyContext context)
14 | {
15 | return null;
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ContextGeneratorTests.NamespacedContext#MyApp.Namespaced.ComponentIndex.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyApp.Namespaced.ComponentIndex.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ContextGenerator.ComponentIndex
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace MyApp.Namespaced
12 | {
13 | public readonly struct ComponentIndex : global::System.IEquatable
14 | {
15 | public readonly int Value;
16 |
17 | public ComponentIndex(int value)
18 | {
19 | Value = value;
20 | }
21 |
22 | public bool Equals(ComponentIndex other) => Value == other.Value;
23 | #nullable enable
24 | public override bool Equals(object? obj) => obj is ComponentIndex other && Equals(other);
25 | #nullable disable
26 | public override int GetHashCode() => Value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ContextGeneratorTests.NamespacedContext#MyApp.Namespaced.Entity.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyApp.Namespaced.Entity.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ContextGenerator.Entity
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace MyApp.Namespaced
12 | {
13 | public sealed class Entity : global::Entitas.Entity { }
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ContextGeneratorTests.NamespacedContext#MyApp.NamespacedContext.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: MyApp.NamespacedContext.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ContextGenerator.Context
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace MyApp
12 | {
13 | public sealed partial class NamespacedContext : global::Entitas.Context
14 | {
15 | public static string[] ComponentNames;
16 | public static global::System.Type[] ComponentTypes;
17 |
18 | public NamespacedContext() :
19 | base(
20 | ComponentTypes.Length,
21 | 0,
22 | new global::Entitas.ContextInfo(
23 | "MyApp.NamespacedContext",
24 | ComponentNames,
25 | ComponentTypes
26 | ),
27 | #if (ENTITAS_FAST_AND_UNSAFE)
28 | global::Entitas.UnsafeAERC.Delegate,
29 | #else
30 | global::Entitas.SafeAERC.Delegate,
31 | #endif
32 | () => new Namespaced.Entity()
33 | ) { }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ContextGeneratorTests.SomeContext#Some.ComponentIndex.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: Some.ComponentIndex.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ContextGenerator.ComponentIndex
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace Some
12 | {
13 | public readonly struct ComponentIndex : global::System.IEquatable
14 | {
15 | public readonly int Value;
16 |
17 | public ComponentIndex(int value)
18 | {
19 | Value = value;
20 | }
21 |
22 | public bool Equals(ComponentIndex other) => Value == other.Value;
23 | #nullable enable
24 | public override bool Equals(object? obj) => obj is ComponentIndex other && Equals(other);
25 | #nullable disable
26 | public override int GetHashCode() => Value;
27 | }
28 | }
29 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ContextGeneratorTests.SomeContext#Some.Entity.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: Some.Entity.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ContextGenerator.Entity
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | namespace Some
12 | {
13 | public sealed class Entity : global::Entitas.Entity { }
14 | }
15 |
--------------------------------------------------------------------------------
/tests/Entitas.Generators.Tests/snapshots/ContextGeneratorTests.SomeContext#SomeContext.g.verified.cs:
--------------------------------------------------------------------------------
1 | //HintName: SomeContext.g.cs
2 | //------------------------------------------------------------------------------
3 | //
4 | // This code was generated by
5 | // Entitas.Generators.ContextGenerator.Context
6 | //
7 | // Changes to this file may cause incorrect behavior and will be lost if
8 | // the code is regenerated.
9 | //
10 | //------------------------------------------------------------------------------
11 | public sealed partial class SomeContext : global::Entitas.Context
12 | {
13 | public static string[] ComponentNames;
14 | public static global::System.Type[] ComponentTypes;
15 |
16 | public SomeContext() :
17 | base(
18 | ComponentTypes.Length,
19 | 0,
20 | new global::Entitas.ContextInfo(
21 | "SomeContext",
22 | ComponentNames,
23 | ComponentTypes
24 | ),
25 | #if (ENTITAS_FAST_AND_UNSAFE)
26 | global::Entitas.UnsafeAERC.Delegate,
27 | #else
28 | global::Entitas.SafeAERC.Delegate,
29 | #endif
30 | () => new Some.Entity()
31 | ) { }
32 | }
33 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/ContextInfoTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using Xunit;
3 |
4 | namespace Entitas.Tests
5 | {
6 | public class ContextInfoTests
7 | {
8 | [Fact]
9 | public void SetsFieldsWithConstructorValues()
10 | {
11 | var contextName = "My Context";
12 | var componentNames = new[] { "Health", "Position", "View" };
13 | var componentTypes = new[] { typeof(ComponentA), typeof(ComponentB), typeof(ComponentC) };
14 | var info = new ContextInfo(contextName, componentNames, componentTypes);
15 |
16 | info.Name.Should().Be(contextName);
17 | info.ComponentNames.Should().BeSameAs(componentNames);
18 | info.ComponentTypes.Should().BeSameAs(componentTypes);
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/Entitas.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultTestTargetFramework)
5 | false
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | all
15 | runtime; build; native; contentfiles; analyzers; buildtransitive
16 |
17 |
18 | all
19 | runtime; build; native; contentfiles; analyzers; buildtransitive
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/EntitasExceptionTests.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using Xunit;
3 |
4 | namespace Entitas.Tests
5 | {
6 | public class EntitasExceptionTests
7 | {
8 | [Fact]
9 | public void CreatesExceptionWithHintSeparatedByNewLine()
10 | {
11 | new EntitasException("Message", "Hint").Message
12 | .Should().Be("Message\nHint");
13 | }
14 |
15 | [Fact]
16 | public void IgnoresHintWhenNull()
17 | {
18 | new EntitasException("Message", null).Message
19 | .Should().Be("Message");
20 | }
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/EntitasStringExtension.cs:
--------------------------------------------------------------------------------
1 | using FluentAssertions;
2 | using Xunit;
3 |
4 | namespace Entitas.Tests
5 | {
6 | public class EntitasStringExtension
7 | {
8 | [Fact]
9 | public void DoesNotChangeStringWhenNotEndingWithSuffix()
10 | {
11 | "Word".RemoveSuffix("Test").Should().Be("Word");
12 | }
13 |
14 | [Fact]
15 | public void RemovesSuffixWhenEndingWithSuffix()
16 | {
17 | "WordTest".RemoveSuffix("Test").Should().Be("Word");
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/fixtures/Systems/CleanupSystemSpy.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class CleanupSystemSpy : ICleanupSystem
4 | {
5 | public int DidCleanup => _didCleanup;
6 |
7 | int _didCleanup;
8 |
9 | public void Cleanup() => _didCleanup += 1;
10 | }
11 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/fixtures/Systems/ExecuteSystemSpy.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class ExecuteSystemSpy : IExecuteSystem
4 | {
5 | public int DidExecute => _didExecute;
6 |
7 | int _didExecute;
8 |
9 | public void Execute() => _didExecute += 1;
10 | }
11 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/fixtures/Systems/InitializeSystemSpy.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class InitializeSystemSpy : IInitializeSystem
4 | {
5 | public int DidInitialize => _didInitialize;
6 |
7 | int _didInitialize;
8 |
9 | public void Initialize() => _didInitialize += 1;
10 | }
11 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/fixtures/Systems/TearDownSystemSpy.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class TearDownSystemSpy : ITearDownSystem
4 | {
5 | public int DidTearDown => _didTearDown;
6 |
7 | int _didTearDown;
8 |
9 | public void TearDown() => _didTearDown += 1;
10 | }
11 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/fixtures/Systems/TestParallelSystem.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Threading;
3 | using Entitas;
4 |
5 | public sealed class TestParallelSystem : ParallelSystem
6 | {
7 | public Exception Exception;
8 |
9 | public TestParallelSystem(TestContext context) : base(context.GetGroup(TestUserMatcher.User)) { }
10 |
11 | protected override void Execute(TestEntity entity)
12 | {
13 | if (Exception != null)
14 | {
15 | throw Exception;
16 | }
17 |
18 | var user = entity.GetUser();
19 | user.Name += "-Processed";
20 | user.Age = Thread.CurrentThread.ManagedThreadId;
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/tests/Entitas.Tests/fixtures/UserComponent.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public sealed class UserComponent : IComponent
4 | {
5 | public string Name;
6 | public int Age;
7 |
8 | public override string ToString()
9 | {
10 | return $"User({Name}, {Age})";
11 | }
12 | }
13 |
14 | namespace My.Namespace
15 | {
16 | public sealed class UserComponent : IComponent
17 | {
18 | public string Name;
19 | public int Age;
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/tests/Entitas.Unity.Tests/Entitas.Unity.Tests.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | $(DefaultTestTargetFramework)
5 | false
6 | false
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 | all
15 | runtime; build; native; contentfiles; analyzers; buildtransitive
16 |
17 |
18 | all
19 | runtime; build; native; contentfiles; analyzers; buildtransitive
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/tests/Entitas.Unity.Tests/fixtures/TestCleanupSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class TestCleanupSystem : ICleanupSystem
4 | {
5 | public void Cleanup() { }
6 | }
7 |
--------------------------------------------------------------------------------
/tests/Entitas.Unity.Tests/fixtures/TestExecuteSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class TestExecuteSystem : IExecuteSystem
4 | {
5 | public void Execute() { }
6 | }
7 |
--------------------------------------------------------------------------------
/tests/Entitas.Unity.Tests/fixtures/TestInitializeSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class TestInitializeSystem : IInitializeSystem
4 | {
5 | public void Initialize() { }
6 | }
7 |
--------------------------------------------------------------------------------
/tests/Entitas.Unity.Tests/fixtures/TestReactiveSystem.cs:
--------------------------------------------------------------------------------
1 | using System.Collections.Generic;
2 | using Entitas;
3 |
4 | public class TestReactiveSystem : ReactiveSystem
5 | {
6 | public TestReactiveSystem(IContext context) : base(context) { }
7 |
8 | protected override ICollector GetTrigger(IContext context)
9 | {
10 | return context.CreateCollector(Matcher.AllOf(0));
11 | }
12 |
13 | protected override bool Filter(Entity entity)
14 | {
15 | return true;
16 | }
17 |
18 | protected override void Execute(List entities) { }
19 | }
20 |
--------------------------------------------------------------------------------
/tests/Entitas.Unity.Tests/fixtures/TestTearDownSystem.cs:
--------------------------------------------------------------------------------
1 | using Entitas;
2 |
3 | public class TestTearDownSystem : ITearDownSystem
4 | {
5 | public void TearDown() { }
6 | }
7 |
--------------------------------------------------------------------------------