From c914ee9863778fd78e4b4539955cf23abef74882 Mon Sep 17 00:00:00 2001 From: sebas77 Date: Tue, 18 Sep 2018 13:36:44 +0100 Subject: [PATCH] improve formatting, changed version, update submodule --- Assets/Plugins/Svelto.ECS | 2 +- .../Svelto-ECS-Example/Scripts/MainContext.cs | 34 +++++++++---------- ProjectSettings/ProjectVersion.txt | 2 +- 3 files changed, 18 insertions(+), 20 deletions(-) diff --git a/Assets/Plugins/Svelto.ECS b/Assets/Plugins/Svelto.ECS index ed99cbd..d059a24 160000 --- a/Assets/Plugins/Svelto.ECS +++ b/Assets/Plugins/Svelto.ECS @@ -1 +1 @@ -Subproject commit ed99cbd82005a55e9b13980793ee1550322a7dda +Subproject commit d059a24aecf19cdfd0a7ba87b5e25af2ec30169b diff --git a/Assets/Svelto-ECS-Example/Scripts/MainContext.cs b/Assets/Svelto-ECS-Example/Scripts/MainContext.cs index d3f578a..90cb3ad 100644 --- a/Assets/Svelto-ECS-Example/Scripts/MainContext.cs +++ b/Assets/Svelto-ECS-Example/Scripts/MainContext.cs @@ -177,7 +177,10 @@ void SetupEngines() //all these engines in the list will be called in order (which in this //case was not important at all, so stretched!!) { - { PlayerDeathCondition.Death, playerMovementEngine, playerAnimationEngine, enemyAnimationEngine, damageSoundEngine, hudEngine} + { + PlayerDeathCondition.Death, playerMovementEngine, playerAnimationEngine, + enemyAnimationEngine, damageSoundEngine, hudEngine + } } } } @@ -231,10 +234,9 @@ void SetupEngines() /// - /// While until recently I thought that creating entities in the context - /// would be all right, I am coming to realise that engines - /// should always handle the creation of entities. - /// I will refactor this when the right time comes. + /// While until recently I thought that creating entities in the context would be all right, I am coming to + /// realise that engines should always handle the creation of entities. I will refactor this when the right + /// time comes. /// void SetupEntities() { @@ -253,22 +255,18 @@ void BuildPlayerEntities() var player = prefabsDictionary.Istantiate("Player"); - //Building entities explicitly should be always preferred - //and MUST be used if an implementor doesn't need to be - //a Monobehaviour. You should strive to create implementors - //not as monobehaviours. Implementors as monobehaviours - //are meant only to function as bridge between Svelto.ECS - //and Unity3D. Using implementor as monobehaviour - //just to read serialized data from the editor, is also - //a bad practice, use a Json file instead. - //The Player Entity is made of EntityViewStruct+Implementors as monobehaviours and - //EntityStructs. The PlayerInputDataStruct doesn't need to be initialized (yay!!) - //but the HealthEntityStruct does. Here I show the official method to do it + //Building entities explicitly should be always preferred and MUST be used if an implementor doesn't need to + //be a Monobehaviour. You should strive to create implementors not as monobehaviours. Implementors as + //monobehaviours are meant only to function as bridge between Svelto.ECS and Unity3D. Using implementor as + //monobehaviour just to read serialized data from the editor, is also a bad practice, use a Json file + //instead. The Player Entity is made of EntityViewStruct+Implementors as monobehaviours and EntityStructs. + //The PlayerInputDataStruct doesn't need to be initialized (yay!!) but the HealthEntityStruct does. + //Here I show the official method to do it var initializer = _entityFactory.BuildEntity(player.GetInstanceID(), ECSGroups.Player, player.GetComponents()); initializer.Init(new HealthEntityStruct {currentHealth = 100}); - //unluckily the gun is parented in the original prefab, so there is no easy way to create it - //explicitly, I have to create if from the existing gameobject. + //unluckily the gun is parented in the original prefab, so there is no easy way to create it explicitly, I + //have to create if from the existing gameobject. var gun = player.GetComponentInChildren(); _entityFactory.BuildEntity(gun.gameObject.GetInstanceID(), ECSGroups.Player, new[] {gun}); diff --git a/ProjectSettings/ProjectVersion.txt b/ProjectSettings/ProjectVersion.txt index 20147cb..410e07a 100644 --- a/ProjectSettings/ProjectVersion.txt +++ b/ProjectSettings/ProjectVersion.txt @@ -1 +1 @@ -m_EditorVersion: 2018.2.3f1 +m_EditorVersion: 2018.2.8f1