This repository was archived by the owner on Jan 18, 2022. It is now read-only.
File tree 6 files changed +25
-13
lines changed
workers/unity/Packages/io.improbable.gdk.transformsynchronization
6 files changed +25
-13
lines changed Original file line number Diff line number Diff line change 27
27
- The 'Build Configuration' Inspector window will no longer report your Android SDK installation as missing if you have a completely fresh Unity installation with the bundled Android SDK. [ #1441 ] ( https://github.com/spatialos/gdk-for-unity/pull/1441 )
28
28
- Fixed a bug where having spaces in the path to your project would cause the 'Local launch' and 'Launch standalone client' menu options to fail on MacOS. [ #1442 ] ( https://github.com/spatialos/gdk-for-unity/pull/1442 )
29
29
- Fixed a faulty sync point caused by using ` ComponentDataFromEntity ` of the ` WorkerSystem ` . [ #1430 ] ( https://github.com/spatialos/gdk-for-unity/pull/1430 )
30
+ - Fixed a bug where the Transform Sync Feature Module would not correctly apply the ` Is Kinematic ` option. [ #1456 ] ( https://github.com/spatialos/gdk-for-unity/pull/1456 )
30
31
31
32
### Internal
32
33
Original file line number Diff line number Diff line change 4
4
using Improbable . Gdk . Core ;
5
5
using Unity . Entities ;
6
6
using UnityEngine ;
7
+ using static Improbable . Gdk . TransformSynchronization . TransformUtils ;
7
8
8
9
namespace Improbable . Gdk . TransformSynchronization
9
10
{
@@ -32,7 +33,7 @@ protected override void OnCreate()
32
33
internal void RegisterTransformSyncType < T > ( ITransformSync < T > impl )
33
34
where T : class
34
35
{
35
- var entityQuery = GetEntityQuery ( TransformUtils . ConstructEntityQueryDesc < T > ( requireAuthority : false , baseComponentTypes ) ) ;
36
+ var entityQuery = GetEntityQuery ( ConstructEntityQueryDesc < T > ( AuthorityRequirements . Exclude , baseComponentTypes ) ) ;
36
37
37
38
applyLatestTransformActions . Add ( typeof ( T ) ,
38
39
( ) => Entities . With ( entityQuery )
@@ -42,7 +43,7 @@ internal void RegisterTransformSyncType<T>(ITransformSync<T> impl)
42
43
43
44
private void UpdateTransformQuery ( )
44
45
{
45
- var transformQueryDesc = TransformUtils . ConstructEntityQueryDesc < UnityEngine . Transform > ( requireAuthority : false , baseComponentTypes ) ;
46
+ var transformQueryDesc = ConstructEntityQueryDesc < UnityEngine . Transform > ( AuthorityRequirements . Exclude , baseComponentTypes ) ;
46
47
transformQueryDesc . None = transformQueryDesc . None
47
48
. Union (
48
49
applyLatestTransformActions . Keys
Original file line number Diff line number Diff line change 4
4
using Improbable . Gdk . Core ;
5
5
using Unity . Entities ;
6
6
using UnityEngine ;
7
+ using static Improbable . Gdk . TransformSynchronization . TransformUtils ;
7
8
8
9
namespace Improbable . Gdk . TransformSynchronization
9
10
{
@@ -32,7 +33,7 @@ protected override void OnCreate()
32
33
internal void RegisterTransformSyncType < T > ( ITransformSync < T > impl )
33
34
where T : class
34
35
{
35
- var entityQuery = GetEntityQuery ( TransformUtils . ConstructEntityQueryDesc < T > ( requireAuthority : true , baseComponentTypes ) ) ;
36
+ var entityQuery = GetEntityQuery ( ConstructEntityQueryDesc < T > ( AuthorityRequirements . Require , baseComponentTypes ) ) ;
36
37
37
38
updateLatestTransformActions . Add ( typeof ( T ) ,
38
39
( ) => Entities . With ( entityQuery )
@@ -43,7 +44,7 @@ internal void RegisterTransformSyncType<T>(ITransformSync<T> impl)
43
44
44
45
private void UpdateTransformQuery ( )
45
46
{
46
- var transformQueryDesc = TransformUtils . ConstructEntityQueryDesc < UnityEngine . Transform > ( requireAuthority : true , baseComponentTypes ) ;
47
+ var transformQueryDesc = ConstructEntityQueryDesc < UnityEngine . Transform > ( AuthorityRequirements . Require , baseComponentTypes ) ;
47
48
transformQueryDesc . None = updateLatestTransformActions . Keys
48
49
. Select ( ComponentType . ReadOnly )
49
50
. ToArray ( ) ;
Original file line number Diff line number Diff line change 3
3
using System . Linq ;
4
4
using Improbable . Gdk . Core ;
5
5
using Unity . Entities ;
6
- using UnityEngine ;
6
+ using static Improbable . Gdk . TransformSynchronization . TransformUtils ;
7
7
8
8
namespace Improbable . Gdk . TransformSynchronization
9
9
{
@@ -49,7 +49,7 @@ protected override void OnCreate()
49
49
internal void RegisterTransformSyncType < T > ( ITransformSync < T > impl )
50
50
where T : class
51
51
{
52
- var componentQueryDesc = TransformUtils . ConstructEntityQueryDesc < T > ( requireAuthority : true , baseComponentTypes ) ;
52
+ var componentQueryDesc = ConstructEntityQueryDesc < T > ( AuthorityRequirements . Require , baseComponentTypes ) ;
53
53
componentQueryDesc . None = baseExcludeComponentTypes ;
54
54
55
55
var entityQuery = GetEntityQuery ( componentQueryDesc ) ;
@@ -81,7 +81,7 @@ internal void RegisterTransformSyncType<T>(ITransformSync<T> impl)
81
81
82
82
private void UpdateTransformQuery ( )
83
83
{
84
- var transformQueryDesc = TransformUtils . ConstructEntityQueryDesc < UnityEngine . Transform > ( requireAuthority : true , baseComponentTypes ) ;
84
+ var transformQueryDesc = ConstructEntityQueryDesc < UnityEngine . Transform > ( AuthorityRequirements . Require , baseComponentTypes ) ;
85
85
transformQueryDesc . None = resetAuthorityActions . Keys
86
86
. Select ( ComponentType . ReadOnly )
87
87
. Concat ( baseExcludeComponentTypes )
Original file line number Diff line number Diff line change 3
3
using System . Linq ;
4
4
using Improbable . Gdk . Core ;
5
5
using Unity . Entities ;
6
+ using static Improbable . Gdk . TransformSynchronization . TransformUtils ;
6
7
7
8
namespace Improbable . Gdk . TransformSynchronization
8
9
{
@@ -55,15 +56,15 @@ internal void RegisterTransformSyncType<T>(ITransformSync<T> impl)
55
56
private void CreateInitAction < T > ( EntityQueryBuilder . F_DC < KinematicStateWhenAuth , T > initFunc )
56
57
where T : class
57
58
{
58
- var entityQuery = GetEntityQuery ( TransformUtils . ConstructEntityQueryDesc < T > ( requireAuthority : false , initBaseComponentTypes ) ) ;
59
+ var entityQuery = GetEntityQuery ( ConstructEntityQueryDesc < T > ( AuthorityRequirements . Exclude , initBaseComponentTypes ) ) ;
59
60
60
61
initKinematicActions . Add ( typeof ( T ) , ( ) => Entities . With ( entityQuery ) . ForEach ( initFunc ) ) ;
61
62
}
62
63
63
64
private void CreateAuthChangeAction < T > ( AuthChangeFunc < T > authFunc )
64
65
where T : class
65
66
{
66
- var componentQueryDesc = TransformUtils . ConstructEntityQueryDesc < T > ( requireAuthority : false , authBaseComponentTypes ) ;
67
+ var componentQueryDesc = ConstructEntityQueryDesc < T > ( AuthorityRequirements . Ignore , authBaseComponentTypes ) ;
67
68
componentQueryDesc . None = componentQueryDesc . None
68
69
. Append ( ComponentType . ReadOnly < NewlyAddedSpatialOSEntity > ( ) )
69
70
. ToArray ( ) ;
@@ -83,7 +84,8 @@ private void CreateAuthChangeAction<T>(AuthChangeFunc<T> authFunc)
83
84
return ;
84
85
}
85
86
86
- var auth = changes [ changes . Count - 1 ] ;
87
+ // The first element is actually the latest value!
88
+ var auth = changes [ 0 ] ;
87
89
88
90
authFunc ( ref kinematicStateWhenAuth , auth , component ) ;
89
91
} ) ) ;
Original file line number Diff line number Diff line change @@ -70,13 +70,13 @@ public static CompressedQuaternion ToCompressedQuaternion(this Quaternion quater
70
70
/// <param name="baseTypes">The base set of types.</param>
71
71
/// <typeparam name="T">The type to add.</typeparam>
72
72
/// <returns>An <see cref="EntityQueryDesc"/> that is the union of <see cref="baseTypes"/> and typeof(<see cref="T"/>)</returns>
73
- internal static EntityQueryDesc ConstructEntityQueryDesc < T > ( bool requireAuthority , params ComponentType [ ] baseTypes )
73
+ internal static EntityQueryDesc ConstructEntityQueryDesc < T > ( AuthorityRequirements authorityRequirements , params ComponentType [ ] baseTypes )
74
74
{
75
75
var componentType = ComponentType . ReadOnly < T > ( ) ;
76
76
var includedComponentTypes = baseTypes
77
77
. Append ( componentType ) ;
78
78
79
- if ( requireAuthority )
79
+ if ( authorityRequirements == AuthorityRequirements . Require )
80
80
{
81
81
includedComponentTypes = includedComponentTypes
82
82
. Append ( ComponentType . ReadOnly < TransformInternal . HasAuthority > ( ) ) ;
@@ -87,7 +87,7 @@ internal static EntityQueryDesc ConstructEntityQueryDesc<T>(bool requireAuthorit
87
87
All = includedComponentTypes . ToArray ( ) ,
88
88
} ;
89
89
90
- if ( ! requireAuthority )
90
+ if ( authorityRequirements == AuthorityRequirements . Exclude )
91
91
{
92
92
componentQueryDesc . None = new [ ]
93
93
{
@@ -97,5 +97,12 @@ internal static EntityQueryDesc ConstructEntityQueryDesc<T>(bool requireAuthorit
97
97
98
98
return componentQueryDesc ;
99
99
}
100
+
101
+ internal enum AuthorityRequirements
102
+ {
103
+ Exclude ,
104
+ Ignore ,
105
+ Require
106
+ }
100
107
}
101
108
}
You can’t perform that action at this time.
0 commit comments