-
Notifications
You must be signed in to change notification settings - Fork 23
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
42 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
using System; | ||
using Friflo.Engine.ECS; | ||
using NUnit.Framework; | ||
|
||
// ReSharper disable InconsistentNaming | ||
namespace Tests.ECS.Relations | ||
{ | ||
// Fix https://github.com/friflo/Friflo.Engine.ECS/issues/11 | ||
public static class Test_Relations_GitHub_11 | ||
{ | ||
[Test] | ||
public static void Test_Rel_Test() | ||
{ | ||
var store = new EntityStore(); | ||
var entity1 = store.CreateEntity(); | ||
entity1.Add(new MyComponent1 { a = 1 }); | ||
|
||
var entity2 = store.CreateEntity(); | ||
entity2.Add(new MyComponent1 { a = 2 }); | ||
|
||
var entity3 = store.CreateEntity(); | ||
|
||
entity1.AddRelation(new AttackRelation { target = entity3 }); | ||
entity2.AddRelation(new AttackRelation { target = entity3 }); | ||
|
||
entity1.RemoveRelation<AttackRelation>(entity3); | ||
|
||
Assert.AreEqual(1, entity1.GetComponent<MyComponent1>().a); | ||
Assert.AreEqual(2, entity2.GetComponent<MyComponent1>().a); | ||
Console.WriteLine($"{entity1.GetComponent<MyComponent1>().a} {entity2.GetComponent<MyComponent1>().a}"); | ||
} | ||
} | ||
} |