コード例 #1
0
        Aggregate(SnapshotProvider provider)
        {
            Assert.IsTrue(provider.identifier.IsValid);

            identifier = Identifier <Aggregate> .Create();

            gameObject = provider.gameObject;

            _providers.Add(provider);
        }
コード例 #2
0
        public void OnEnable(SnapshotProvider provider)
        {
            Assert.IsTrue(!provider.identifier.IsValid);
            Assert.IsTrue(!provider.aggregate.IsValid);

            if (Application.isPlaying)
            {
                provider.identifier = Identifier <SnapshotProvider> .Create();

                if (_aggregates.ContainsKey(provider.gameObject))
                {
                    var aggregate = this[provider.gameObject];

                    Assert.IsTrue(aggregate.identifier.IsValid);

                    provider.aggregate = aggregate.identifier;

                    aggregate._providers.Add(provider);
                }
                else
                {
                    var aggregate = Aggregate.Create(provider);

                    this[provider.gameObject] = aggregate;

                    provider.aggregate = aggregate.identifier;

                    if (!Debugger.instance.rewind)
                    {
                        var prefab = provider.GetComponent <Prefab>();

                        if (prefab != null)
                        {
                            var prefabReference = prefab.prefab.gameObject;

                            _prefabReferences[provider.aggregate] = new PrefabReference
                            {
                                gameObject = prefabReference,
                                identifier = provider.identifier
                            };
                        }
                    }
                }

                Assert.IsTrue(provider.aggregate.IsValid);
                Assert.IsTrue(provider.identifier.IsValid);

                Assert.IsTrue(this[provider.gameObject].identifier == provider.aggregate);
                Assert.IsTrue(this[provider.gameObject].Find(provider.identifier) == provider);
            }
        }
コード例 #3
0
        Snapshot(float startTime, float deltaTime)
        {
            startTimeInSeconds = startTime;
            durationInSeconds  = deltaTime;

            identifier = Identifier <Snapshot> .Create();

            var registry = Debugger.registry;

            foreach (var src in registry.aggregates)
            {
                var dst = AggregateReference.Create(src.identifier);

                foreach (var provider in src.providers)
                {
                    dst.Create(provider);
                }

                _aggregates.Add(dst);
            }
        }