public void Add_returns_false_if_already_added() { var registery = new EntityRegistery(); var system = new TestEntitySystem(); var result = registery.Add(system); var result2 = registery.Add(system); Assert.True(result); Assert.False(result2); }
public void Contains_Returns_True_If_System_Is_Added() { var registery = new EntityRegistery(); var system = new TestEntitySystem(); registery.Add(system); Assert.True(registery.Contains(system)); }
public void Get_Returns_System_If_added() { var registery = new EntityRegistery(); var system = new TestEntitySystem(); registery.Add(system); var result = registery.Get <TestEntitySystem>(); Assert.Equal(system, result); }
public void Add_Set_Registery_On_System() { var registery = new EntityRegistery(); var system = new TestEntitySystem(); var result = registery.Add(system); Assert.True(result); Assert.Equal(registery, system.Registery); }
public void Add_Sets_Component_EntityRecord() { var registery = new EntityRegistery(); var record = registery.Create("Test Entity"); var component = new TestComponent(); registery.Add(record, component); Assert.Equal(record, component.Record); }
public void Remove_Removes_A_Component_From_An_Entity() { var registery = new EntityRegistery(); var record = registery.Create("Test Entity"); registery.Add(record, new TestComponent()); var component = record.GetComponent <TestComponent>(); Assert.NotNull(record.GetComponent <TestComponent>()); Assert.True(registery.Remove(record, component)); Assert.Null(record.GetComponent <TestComponent>()); }
public void Add_Component_To_Entity() { var registery = new EntityRegistery(); var entity = registery.Create(); var testComponent = new TestComponent(); registery.Add(entity, testComponent); var component = registery.GetComponent <TestComponent>(entity); Assert.Equal(testComponent, component); }
static void Main(string[] args) { var registery = new EntityRegistery(); registery.Add(new SampleSystem()); var e = registery.Create(); e.AddComponent(new SampleComponent()); for (float delta = 0f; delta < 1000f; delta++) { registery.Update(delta); } }
public void Get_Component_Gets_Added_Components() { var registery = new EntityRegistery(); var record = registery.Create("Test Entity"); var component = new TestComponent(); registery.Add(record, component); var registeryComponent = registery.GetComponent <TestComponent>(record); Assert.Equal(component, registeryComponent); var entityComponent = record.GetComponent <TestComponent>(); Assert.Equal(component, entityComponent); }