Skip to content

Commit

Permalink
QOL changes
Browse files Browse the repository at this point in the history
  • Loading branch information
knowlife4 committed Jan 20, 2023
1 parent efa3b21 commit dda7271
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 11 deletions.
15 changes: 12 additions & 3 deletions ECT/Assets/Runtime/ECTAction.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,28 @@ namespace ECT
{
public class ECTAction
{
public List<Action> Callbacks { get; } = new();
private List<Action> callbacks;

public List<Action> Callbacks
{
get
{
callbacks ??= new();
return callbacks;
}
}

public bool Contains(Action function) => Callbacks.Contains(function);

public void Subscribe(Action function)
{
if(Contains(function)) return;
if (Contains(function)) return;
Callbacks.Add(function);
}

public void Unsubscribe(Action function)
{
if(!Contains(function)) return;
if (!Contains(function)) return;
Callbacks.Remove(function);
}

Expand Down
2 changes: 2 additions & 0 deletions ECT/Assets/Runtime/ECTEntity.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ public ECTReferenceBranch ReferenceBranch
public abstract class EntityComponent : ECTComponent<MyEntity, MyEntity, EntityComponent> { }

public ECTValidation QuerySystem<FindSystem>(out FindSystem find) where FindSystem : class, ISystem => ReferenceBranch.QuerySystem(out find);

protected void UpdateComponents () => referenceBranch.Update(this, this);
}

public interface IEntity : IParent
Expand Down
6 changes: 5 additions & 1 deletion ECT/Assets/Runtime/ECTValidation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@ namespace ECT
public struct ECTValidation
{
public ECTValidation(bool successful) => Successful = successful;
public ECTValidation(object objectToValidate) => Successful = objectToValidate != null;
public static ECTValidation Validate<T>(T input, out T output) where T : class
{
output = input;
return new(input == null);
}

public bool Successful { get; }
}
Expand Down
14 changes: 7 additions & 7 deletions ECT/Packages/packages-lock.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,17 @@
"depth": 0,
"source": "builtin",
"dependencies": {
"com.unity.ide.visualstudio": "2.0.16",
"com.unity.ide.rider": "3.0.16",
"com.unity.ide.visualstudio": "2.0.17",
"com.unity.ide.rider": "3.0.17",
"com.unity.ide.vscode": "1.2.5",
"com.unity.editorcoroutines": "1.0.0",
"com.unity.performance.profile-analyzer": "1.1.1",
"com.unity.test-framework": "1.1.33",
"com.unity.testtools.codecoverage": "1.2.1"
"com.unity.testtools.codecoverage": "1.2.2"
}
},
"com.unity.ide.rider": {
"version": "3.0.16",
"version": "3.0.17",
"depth": 1,
"source": "registry",
"dependencies": {
Expand All @@ -47,7 +47,7 @@
"url": "https://packages.unity.com"
},
"com.unity.ide.visualstudio": {
"version": "2.0.16",
"version": "2.0.17",
"depth": 1,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -77,7 +77,7 @@
"url": "https://packages.unity.com"
},
"com.unity.services.core": {
"version": "1.6.0",
"version": "1.7.0",
"depth": 1,
"source": "registry",
"dependencies": {
Expand Down Expand Up @@ -122,7 +122,7 @@
"url": "https://packages.unity.com"
},
"com.unity.testtools.codecoverage": {
"version": "1.2.1",
"version": "1.2.2",
"depth": 1,
"source": "registry",
"dependencies": {
Expand Down

0 comments on commit dda7271

Please sign in to comment.