public void Initialize(ManagedExecutionSystem system)
        {
            int groupCount = system.ExecutionGroups.Count;

            _executionGroups   = new ManagedExecutionGroup[groupCount];
            _updateGroups      = new RuntimeGroup[groupCount];
            _fixedUpdateGroups = new RuntimeGroup[groupCount];

            for (int i = 0; i < groupCount; i++)
            {
                List <ManagedUpdatesBehaviour> updateList      = new List <ManagedUpdatesBehaviour>();
                List <ManagedUpdatesBehaviour> fixedUpdateList = new List <ManagedUpdatesBehaviour>();

                ManagedExecutionGroup currentGroup = system.ExecutionGroups[i];

                currentGroup.TraverseForType(
                    UpdateType.Normal,
                    (c) => { updateList.Add(c); }
                    );

                currentGroup.TraverseForType(
                    UpdateType.Fixed,
                    (c) => { fixedUpdateList.Add(c); }
                    );

                _executionGroups[i]   = currentGroup;
                _updateGroups[i]      = new RuntimeGroup(updateList.ToArray());
                _fixedUpdateGroups[i] = new RuntimeGroup(fixedUpdateList.ToArray());
            }
        }
예제 #2
0
        private RuntimeGraph SafeMerge(RuntimeGraph existingGraph, RuntimeGroup runtimeGroup)
        {
            var runtimeGraph = runtimeGroup.GetRuntimeGraph();

            foreach (var existingRuntimeDescription in existingGraph.Runtimes.Values)
            {
                RuntimeDescription newRuntimeDescription;

                if (runtimeGraph.Runtimes.TryGetValue(existingRuntimeDescription.RuntimeIdentifier, out newRuntimeDescription))
                {
                    // overlapping RID, ensure that the imports match (same ordering and content)
                    if (!existingRuntimeDescription.InheritedRuntimes.SequenceEqual(newRuntimeDescription.InheritedRuntimes))
                    {
                        Log.LogError($"RuntimeGroup {runtimeGroup.BaseRID} defines RID {newRuntimeDescription.RuntimeIdentifier} with imports {String.Join(";", newRuntimeDescription.InheritedRuntimes)} which differ from existing imports {String.Join(";", existingRuntimeDescription.InheritedRuntimes)}.  You may avoid this by specifying {nameof(RuntimeGroup.OmitRIDDefinitions)} metadata with {newRuntimeDescription.RuntimeIdentifier}.");
                    }
                }
            }

            return(RuntimeGraph.Merge(existingGraph, runtimeGraph));
        }