Пример #1
0
        /// <summary>
        /// Creates a link between a Person and a Place.
        /// </summary>
        /// <param name="linkedPerson">Linked Person</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">The nature of the tie between a Person and a Place</param>
        /// <param name="started">Date Started</param>
        /// <param name="ended">Date Ended</param>
        /// <returns>The new link</returns>
        public PersonalTie CreateTieBetweenPersonAndPlace(Person linkedPerson, Place linkedPlace, PersonalTieType type, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            var personalTie = new PersonalTie(linkedPlace, linkedPerson, type, Guid.NewGuid(), started, ended);

            linkedPerson.AddLinkedPlace(personalTie);
            linkedPlace.AddLinkedPerson(personalTie);

            return(personalTie);
        }
Пример #2
0
        /// <summary>
        /// Creates a link between a Person and a Place.
        /// </summary>
        /// <param name="linkedPerson">Linked Person</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">The nature of the tie between a Person and a Place</param>
        /// <returns>The new link</returns>
        public PersonalTie CreateTieBetweenPersonAndPlace(Person linkedPerson, Place linkedPlace, PersonalTieType type)
        {
            var personalTie = new PersonalTie(linkedPlace, linkedPerson, type, Guid.NewGuid());

            linkedPerson.AddLinkedPlace(personalTie);
            linkedPlace.AddLinkedPerson(personalTie);

            return(personalTie);
        }
Пример #3
0
        internal void AddLinkedPerson(PersonalTie newLinkedPerson)
        {
            if (_linkedPersons == null)
            {
                _linkedPersons = new List <PersonalTie>();
            }

            if (!_linkedPersons.Exists(p => p.Name == newLinkedPerson.Name))
            {
                _linkedPersons.Add(newLinkedPerson);
            }
        }
Пример #4
0
        internal void AddLinkedPlace(PersonalTie newLinkedPlace)
        {
            if (_linkedPlaces == null)
            {
                _linkedPlaces = new List <PersonalTie>();
            }

            if (!_linkedPlaces.Exists(p => p.LinkedLocation.Name == newLinkedPlace.LinkedLocation.Name && p.LinkedLocation.Type == newLinkedPlace.LinkedLocation.Type))
            {
                _linkedPlaces.Add(newLinkedPlace);
            }
        }
Пример #5
0
        /// <inheritdoc />
        public override MemoryItem GetAccurateCopy()
        {
            var copy = new PersonalTie(LinkedLocation, LinkedPerson, Type, ReferenceId, Started, Ended)
            {
                ItemType           = ItemType,
                Description        = Description,
                ReverseDescription = ReverseDescription,
                Name = Name
            };

            return(copy);
        }
Пример #6
0
        /// <inheritdoc />
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime started = Started;
            GameTime.GameTime ended   = Ended;
            PersonalTieType   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 = (PersonalTieType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(PersonalTieType)).Length);
                break;

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

            var copy = new PersonalTie(LinkedLocation, LinkedPerson, type, ReferenceId, started, ended)
            {
                ItemType           = ItemType,
                Description        = Description,
                ReverseDescription = ReverseDescription,
                Name = Name
            };

            return(copy);
        }