예제 #1
0
        /// <summary>
        ///     Creates a new instance of <c>EntityObject</c>.
        /// </summary>
        /// <param name="entityId">The associated EntityId.</param>
        /// <param name="underlyingGameObject">The GameObject associated with the Entity.</param>
        /// <param name="prefabName">The prefab name associated with the Entity.</param>
        /// <param name="interestedComponentUpdaterProvider">
        ///     IInterestedComponentUpdaterProvider for callign
        ///     OnInterestedComponentsPotentiallyChanged().
        /// </param>
        public EntityObject(EntityId entityId, GameObject underlyingGameObject, string prefabName, IInterestedComponentUpdaterProvider interestedComponentUpdaterProvider)
        {
            this.interestedComponentUpdaterProvider = interestedComponentUpdaterProvider;

            if (underlyingGameObject == null)
            {
                throw new ArgumentNullException("underlyingGameObject");
            }

            EntityId             = entityId;
            UnderlyingGameObject = underlyingGameObject;
            PrefabName           = prefabName;

            Visualizers = new EntityVisualizers(UnderlyingGameObject);
            Components  = new EntityComponents();
            Visualizers.AddInvalidator(this);
            Components.AddInvalidator(this);
        }
        public LegacyEntityCreator(IEntityTemplateProvider templateProvider,
                                   ISpatialCommunicator spatialCommunicator,
                                   IPrefabFactory <GameObject> prefabFactory,
                                   IMutableUniverse universe,
                                   IEntityComponentInterestOverridesUpdater entityComponentInterestOverridesUpdater,
                                   IInterestedComponentUpdaterProvider interestedComponentUpdaterProvider,
                                   WorkerMetrics metrics)
        {
            this.templateProvider    = templateProvider;
            this.prefabFactory       = new PrefabFactoryMetrics(prefabFactory, metrics); // Associate metrics with the factory
            this.spatialCommunicator = spatialCommunicator;
            this.universe            = universe;
            this.entityComponentInterestOverridesUpdater = entityComponentInterestOverridesUpdater;
            this.interestedComponentUpdaterProvider      = interestedComponentUpdaterProvider;

            entitiesToSpawn = new Dictionary <EntityId, EntitySpawnData>();
            knownEntities   = new HashSet <EntityId>();

            this.metrics = metrics;
        }
 public LegacyEntityPipelineConfiguration(IEntityComponentInterestOverridesUpdater entityComponentInterestOverridesUpdater, IInterestedComponentUpdaterProvider interestedComponentUpdaterProvider)
 {
     this._entityComponentInterestOverridesUpdater = entityComponentInterestOverridesUpdater;
     this.interestedComponentUpdaterProvider       = interestedComponentUpdaterProvider;
 }