Exemplo n.º 1
0
        /// <summary>
        /// Creates a link between an Event and a Place
        /// </summary>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Place and Event</param>
        /// <param name="started">Date Started</param>
        /// <param name="ended">Date Ended</param>
        /// <returns>The new link</returns>
        public Occurence CreateOccurenceBetweenEventAndPlace(PastEvent linkedEvent, Place linkedPlace, OccurenceType type, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            var occurence = new Occurence(linkedPlace, linkedEvent, type, Guid.NewGuid(), started, ended);

            linkedPlace.AddLinkedEvent(occurence);
            linkedEvent.AddLinkedPlace(occurence);

            return(occurence);
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a link between an Event and a Place
        /// </summary>
        /// <param name="linkedEvent">Event linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Place and Event</param>
        /// <returns>The new link</returns>
        public Occurence CreateOccurenceBetweenEventAndPlace(PastEvent linkedEvent, Place linkedPlace, OccurenceType type)
        {
            var occurence = new Occurence(linkedPlace, linkedEvent, type, Guid.NewGuid());

            linkedPlace.AddLinkedEvent(occurence);
            linkedEvent.AddLinkedPlace(occurence);

            return(occurence);
        }
Exemplo n.º 3
0
        internal void AddLinkedEvent(Occurence pastEvent)
        {
            if (_linkedEvents == null)
            {
                _linkedEvents = new List <Occurence>();
            }

            if (!_linkedEvents.Exists(e => e.Name == pastEvent.Name))
            {
                _linkedEvents.Add(pastEvent);
            }
        }
Exemplo n.º 4
0
        public void AddLinkedPlace(Occurence newPlace)
        {
            if (_linkedPlaces == null)
            {
                _linkedPlaces = new List <Occurence>();
            }

            if (!_linkedPlaces.Exists(p => p.Name == newPlace.Name && p.Type == newPlace.Type))
            {
                _linkedPlaces.Add(newPlace);
            }
        }
Exemplo n.º 5
0
        /// <inheritdoc />
        public override MemoryItem GetAccurateCopy()
        {
            var copy = new Occurence(LinkedLocation, LinkedEvent, Type, ReferenceId)
            {
                ItemType           = ItemType,
                Description        = Description,
                ReverseDescription = ReverseDescription,
                Started            = Started,
                Ended = Ended,
                Name  = Name
            };

            return(copy);
        }
Exemplo n.º 6
0
        /// <inheritdoc />
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime started = Started;
            GameTime.GameTime ended   = Ended;
            OccurenceType     type    = Type;

            //TODO : Randomize name

            int falsificationCase = RandomValueGenerator.GenerateIntWithMaxValue(4);

            switch (falsificationCase)
            {
            case 1:
                int variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;

            case 2:
                int deathVariance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                ended?.SetYear(ended.GetYear() + deathVariance);
                break;

            case 3:
                type = (OccurenceType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(OccurenceType)).Length);
                break;

            case 4:
                type     = (OccurenceType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(OccurenceType)).Length);
                variance = RandomValueGenerator.GenerateRealWithinValues(-10, 10);
                started?.SetYear(started.GetYear() + variance);
                break;
            }

            var copy = new Occurence(LinkedLocation, LinkedEvent, type, ReferenceId)
            {
                ItemType           = ItemType,
                Description        = Description,
                ReverseDescription = ReverseDescription,
                Started            = started,
                Ended = ended,
                Name  = Name
            };

            return(copy);
        }