QueryWith and QueryWithout implicitly Read #8

Merged
cosmonaut merged 1 commits from ImplicitReadQuery into master 2020-07-12 22:17:38 +00:00
7 changed files with 11 additions and 14 deletions

View File

@ -1,7 +1,6 @@
using Encompass.Exceptions;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Encompass
{

View File

@ -1,7 +1,5 @@
using Encompass.Exceptions;
using System;
using System;
using System.Collections.Generic;
using System.Linq;
namespace Encompass
{

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Encompass.Exceptions;
namespace Encompass
{

View File

@ -1,7 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using Encompass.Exceptions;
namespace Encompass
{

View File

@ -108,11 +108,21 @@ namespace Encompass
QueryWithTypes = queryWithAttribute.QueryWithTypes;
}
foreach (var queryType in QueryWithTypes)
{
ReadTypes.Add(queryType);
}
var queryWithoutAttribute = GetType().GetCustomAttribute<QueryWithout>(false);
if (queryWithoutAttribute != null)
{
QueryWithoutTypes = queryWithoutAttribute.QueryWithoutTypes;
}
foreach (var queryType in QueryWithoutTypes)
{
ReadTypes.Add(queryType);
}
}
public override bool Equals(object obj)

View File

@ -1,8 +1,6 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime.CompilerServices;
namespace Encompass
{

View File

@ -1411,7 +1411,6 @@ namespace Tests
struct MockComponentC : IComponent { }
struct MockComponentD : IComponent { }
[Reads(typeof(MockComponent), typeof(MockComponentB))]
[Writes(typeof(MockComponentB))]
[QueryWith(typeof(MockComponent), typeof(MockComponentB))]
class EntityQueryWithComponentsEngine : Engine
@ -1465,7 +1464,6 @@ namespace Tests
queriedEntities.Should().BeEmpty();
}
[Reads(typeof(MockComponent))]
[Writes(typeof(MockComponent))]
[QueryWithout(typeof(MockComponent))]
class EntityQueryWithoutComponentsEngine : Engine
@ -1519,7 +1517,6 @@ namespace Tests
queriedEntities.Should().BeEmpty();
}
[Reads(typeof(MockComponent), typeof(MockComponentB), typeof(MockComponentD))]
[QueryWith(typeof(MockComponent), typeof(MockComponentB))]
[QueryWithout(typeof(MockComponentD))]
class EntityQueryWithandWithoutComponentsEngine : Engine
@ -1745,7 +1742,6 @@ namespace Tests
}
[ReadsImmediate(typeof(MockComponentB))]
[Reads(typeof(MockComponent))]
[QueryWith(typeof(MockComponent), typeof(MockComponentB))]
class EntityQueryWithImmediateAndNonImmediateComponents : Engine
{