Skip to content

Commit f62c473

Browse files
Allow injected in Controller
1 parent c1e0de8 commit f62c473

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public class EnemyComponent : EntityComponent<EnemyComponent, EnemySystem> {
6161
public class EnemySystem : EntitySystem<EnemySystem, EnemyComponent> {
6262
[Injected] private AiSystem aiSystem;
6363
[Injected] private AudioService AudioService;
64-
64+
6565
public override void OnEntityInitialized (EnemyComponent entity) {
6666
if (entity.level > 5)
6767
this.aiSystem.Trigger (entity);
@@ -89,6 +89,8 @@ Use build in file generator to create new instances for any of these types.
8989
/// Base class for every controller.
9090
public abstract class Controller {
9191

92+
// NOTE: This class allows the usage of [Injected] systems and services.
93+
9294
/// A reference to the controller.
9395
public static Controller Instance;
9496

@@ -129,7 +131,7 @@ public abstract class Controller {
129131
public abstract class EntityComponent<EntityComponentType, EntitySystemType> : UnityEngine.MonoBehaviour, IEntityComponent
130132
where EntityComponentType : EntityComponent<EntityComponentType, EntitySystemType>, new()
131133
where EntitySystemType : EntitySystem<EntitySystemType, EntityComponentType>, new() {
132-
134+
133135
// NOTE: This class allows the usage of [Referenced] and [Protected] objects and primitives.
134136
135137
/// Sets the game object of the entity active.

Runtime/Controller.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,8 @@ public void Register (params System.Type[] typesOf) {
110110
}
111111
}
112112

113-
// Set Values of the 'InjectedSystem' attributes
113+
// Set Values of the 'Injected' attributes
114+
Injected.SetAttributeValues (this);
114115
for (var _systemIndex = 0; _systemIndex < this.systems.Count; _systemIndex++)
115116
Injected.SetAttributeValues (this.systems[_systemIndex]);
116117
for (var _serviceIndex = 0; _serviceIndex < this.services.Count; _serviceIndex++)

0 commit comments

Comments
 (0)