/// <summary> /// Clones the properties of this instance to a new instance. /// </summary> /// <returns> /// Returns a new instance with the properties of this instance copied to it. /// </returns> /// <para> /// Cloning does not guarantee that the internal state of an object will be cloned nor /// does it guarantee that the clone will be a deep clone or a shallow. /// </para> public IRealm Clone() { var clone = new MudRealm(this.zoneFactory, this.Owner) { Id = this.Id, IsEnabled = this.IsEnabled, Name = this.Name, Owner = this.Owner, TimeZoneOffset = this.TimeZoneOffset, zones = this.zones, }; return(clone); }
/// <summary> /// Creates an unintialized instance of a realm. /// All of the children zones will be initialized prior to being added to the realm. /// </summary> /// <param name="name">The name of the realm.</param> /// <param name="owner">The world that owns this realm.</param> /// <param name="timeZoneOffset">The time zone offset to apply to the realm.</param> /// <param name="zones">A collection of zones that will be initialized and added to the realm.</param> /// <returns>Returns an unintialized instance of IRealm</returns> public async Task <IRealm> CreateRealm(string name, IWorld owner, ITimeOfDay timeZoneOffset, IEnumerable <IZone> zones) { var realm = new MudRealm(this.zoneFactory, owner); if (timeZoneOffset != null) { realm.ApplyTimeZoneOffset(timeZoneOffset.Hour, timeZoneOffset.Minute); } realm.SetName(name); if (zones.Count() > 0) { await realm.AddZonesToRealm(zones); } return(realm); }