Ejemplo n.º 1
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="location">The location to track.</param>
        public LocationTracker(GameLocation location)
        {
            this.Location = location;

            // init watchers
            this.BuildingsWatcher = location is BuildableGameLocation buildableLocation?WatcherFactory.ForNetCollection(buildableLocation.buildings) : WatcherFactory.ForImmutableCollection <Building>();

            this.DebrisWatcher = WatcherFactory.ForNetCollection(location.debris);
            this.LargeTerrainFeaturesWatcher = WatcherFactory.ForNetCollection(location.largeTerrainFeatures);
            this.NpcsWatcher            = WatcherFactory.ForNetCollection(location.characters);
            this.ObjectsWatcher         = WatcherFactory.ForNetDictionary(location.netObjects);
            this.TerrainFeaturesWatcher = WatcherFactory.ForNetDictionary(location.terrainFeatures);
            this.FurnitureWatcher       = WatcherFactory.ForNetCollection(location.furniture);

            this.Watchers.AddRange(new IWatcher[]
            {
                this.BuildingsWatcher,
                this.DebrisWatcher,
                this.LargeTerrainFeaturesWatcher,
                this.NpcsWatcher,
                this.ObjectsWatcher,
                this.TerrainFeaturesWatcher,
                this.FurnitureWatcher
            });

            this.UpdateChestWatcherList(added: location.Objects.Pairs, removed: Array.Empty <KeyValuePair <Vector2, SObject> >());
        }
Ejemplo n.º 2
0
        /*********
        ** Public methods
        *********/
        /// <summary>Construct an instance.</summary>
        /// <param name="location">The location to track.</param>
        public LocationTracker(GameLocation location)
        {
            this.Location = location;

            // init watchers
            this.BuildingsWatcher = location is BuildableGameLocation buildableLocation?WatcherFactory.ForNetCollection(buildableLocation.buildings) : WatcherFactory.ForImmutableCollection <Building>();

            this.DebrisWatcher = WatcherFactory.ForNetCollection(location.debris);
            this.LargeTerrainFeaturesWatcher = WatcherFactory.ForNetCollection(location.largeTerrainFeatures);
            this.NpcsWatcher            = WatcherFactory.ForNetCollection(location.characters);
            this.ObjectsWatcher         = WatcherFactory.ForNetDictionary(location.netObjects);
            this.TerrainFeaturesWatcher = WatcherFactory.ForNetDictionary(location.terrainFeatures);

            this.Watchers.AddRange(new IWatcher[]
            {
                this.BuildingsWatcher,
                this.DebrisWatcher,
                this.LargeTerrainFeaturesWatcher,
                this.NpcsWatcher,
                this.ObjectsWatcher,
                this.TerrainFeaturesWatcher
            });
        }