예제 #1
0
 /// <summary>Initializes a new instance of the <see cref="VanillaEvent"/> class.</summary>
 /// <param name="id">The event ID.</param>
 /// <param name="duration">The city event duration in hours.</param>
 /// <param name="ticketPrice">The event ticket price.</param>
 /// <param name="eventManager">An <see cref="IEventManagerConnection"/> reference.</param>
 public VanillaEvent(ushort id, float duration, float ticketPrice, IEventManagerConnection eventManager)
 {
     this.duration     = duration;
     this.ticketPrice  = ticketPrice;
     EventId           = id;
     this.eventManager = eventManager ?? throw new System.ArgumentNullException(nameof(eventManager));
 }
예제 #2
0
 /// <summary>Initializes a new instance of the <see cref="RealTimeEventManager"/> class.</summary>
 /// <param name="config">The configuration to run with.</param>
 /// <param name="eventProvider">The city event provider implementation.</param>
 /// <param name="eventManager">
 /// A proxy object that provides a way to call the game-specific methods of the <see cref="global::EventManager"/> class.
 /// </param>
 /// <param name="buildingManager">
 /// A proxy object that provides a way to call the game-specific methods of the <see cref="global::BuildingManager"/> class.
 /// </param>
 /// <param name="randomizer">
 /// An object that implements of the <see cref="IRandomizer"/> interface.
 /// </param>
 /// <param name="timeInfo">The time information source.</param>
 /// <exception cref="ArgumentNullException">Thrown when any argument is null.</exception>
 public RealTimeEventManager(
     RealTimeConfig config,
     ICityEventsProvider eventProvider,
     IEventManagerConnection eventManager,
     IBuildingManagerConnection buildingManager,
     IRandomizer randomizer,
     ITimeInfo timeInfo)
 {
     this.config          = config ?? throw new ArgumentNullException(nameof(config));
     this.eventProvider   = eventProvider ?? throw new ArgumentNullException(nameof(eventProvider));
     this.eventManager    = eventManager ?? throw new ArgumentNullException(nameof(eventManager));
     this.buildingManager = buildingManager ?? throw new ArgumentNullException(nameof(buildingManager));
     this.randomizer      = randomizer ?? throw new ArgumentNullException(nameof(randomizer));
     this.timeInfo        = timeInfo ?? throw new ArgumentNullException(nameof(timeInfo));
     upcomingEvents       = new LinkedList <ICityEvent>();
 }
예제 #3
0
        /// <summary>Initializes a new instance of the <see cref="RealTimeEventManager"/> class.</summary>
        /// <param name="config">The configuration to run with.</param>
        /// <param name="eventProvider">The city event provider implementation.</param>
        /// <param name="eventManager">
        /// A proxy object that provides a way to call the game-specific methods of the <see cref="EventManager"/> class.
        /// </param>
        /// <param name="buildingManager">
        /// A proxy object that provides a way to call the game-specific methods of the <see cref="BuildingManager"/> class.
        /// </param>
        /// <param name="randomizer">
        /// An object that implements of the <see cref="IRandomizer"/> interface.
        /// </param>
        /// <param name="timeInfo">The time information source.</param>
        /// <param name="attendingTimeMargin">The time margin in hours specifying the maximum time before an event
        /// can be attended by the citizen.</param>
        /// <exception cref="ArgumentNullException">Thrown when any argument is null.</exception>
        public RealTimeEventManager(
            RealTimeConfig config,
            ICityEventsProvider eventProvider,
            IEventManagerConnection eventManager,
            IBuildingManagerConnection buildingManager,
            IRandomizer randomizer,
            ITimeInfo timeInfo,
            float attendingTimeMargin)
        {
            this.config              = config ?? throw new ArgumentNullException(nameof(config));
            this.eventProvider       = eventProvider ?? throw new ArgumentNullException(nameof(eventProvider));
            this.eventManager        = eventManager ?? throw new ArgumentNullException(nameof(eventManager));
            this.buildingManager     = buildingManager ?? throw new ArgumentNullException(nameof(buildingManager));
            this.randomizer          = randomizer ?? throw new ArgumentNullException(nameof(randomizer));
            this.timeInfo            = timeInfo ?? throw new ArgumentNullException(nameof(timeInfo));
            this.attendingTimeMargin = attendingTimeMargin;

            upcomingEvents      = new LinkedList <ICityEvent>();
            eventsCache         = new List <ICityEvent>();
            readonlyEventsCache = new ReadOnlyList <ICityEvent>(eventsCache);
            eventsToAttend      = new List <ICityEvent>();
            EventsToAttend      = new ReadOnlyList <ICityEvent>(eventsToAttend);
        }