コード例 #1
0
        /// <summary>
        /// This relationship links an Occupation and an Place. It was created to admit that someone might not know the Person linked to an Occupation, i.e. the King of Temeria.
        /// </summary>
        /// <param name="linkedOccupation">Occupation linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Occupation and Place</param>
        /// <param name="started">Date Started</param>
        /// <param name="ended">Date Ended</param>
        /// <returns>The new link</returns>
        public OccupationalTie CreateTieBetweenOccupationAndPlace(Occupation linkedOccupation, Place linkedPlace, OccupationalTieType type, GameTime.GameTime started, GameTime.GameTime ended = null)
        {
            var occupationalTie = new OccupationalTie(linkedPlace, linkedOccupation, type, Guid.NewGuid(), started, ended);

            linkedOccupation.AddLinkedPlace(occupationalTie);
            linkedPlace.AddLinkedOccupation(occupationalTie);

            return(occupationalTie);
        }
コード例 #2
0
        /// <summary>
        /// This relationship links an Occupation and an Place. It was created to admit that someone might not know the Person linked to an Occupation, i.e. the King of Temeria.
        /// </summary>
        /// <param name="linkedOccupation">Occupation linked</param>
        /// <param name="linkedPlace">Linked Place</param>
        /// <param name="type">Nature of the link between Occupation and Place</param>
        /// <returns>The new link</returns>
        public OccupationalTie CreateTieBetweenOccupationAndPlace(Occupation linkedOccupation, Place linkedPlace, OccupationalTieType type)
        {
            var occupationalTie = new OccupationalTie(linkedPlace, linkedOccupation, type, Guid.NewGuid());

            linkedOccupation.AddLinkedPlace(occupationalTie);
            linkedPlace.AddLinkedOccupation(occupationalTie);

            return(occupationalTie);
        }
コード例 #3
0
        public void AddLinkedPlace(OccupationalTie newPlace)
        {
            if (_linkedPlaces == null)
            {
                _linkedPlaces = new List <OccupationalTie>();
            }

            if (!_linkedPlaces.Exists(p => p.Name == newPlace.Name && p.Type == newPlace.Type))
            {
                _linkedPlaces.Add(newPlace);
            }
        }
コード例 #4
0
        public void AddLinkedOccupation(OccupationalTie newOccupation)
        {
            if (_relatedOccupations == null)
            {
                _relatedOccupations = new List <OccupationalTie>();
            }

            if (!_relatedOccupations.Exists(o => o.Name == newOccupation.Name &&
                                            o.LinkedOccupation.OccupationHolder == newOccupation.LinkedOccupation.OccupationHolder))
            {
                _relatedOccupations.Add(newOccupation);
            }
        }
コード例 #5
0
        /// <inheritdoc />
        public override MemoryItem GetAccurateCopy()
        {
            var copy = new OccupationalTie(LinkedLocation, LinkedOccupation, Type, ReferenceId)
            {
                ItemType           = ItemType,
                Description        = Description,
                Started            = Started,
                Ended              = Ended,
                ReverseDescription = ReverseDescription,
                Name = Name
            };

            return(copy);
        }
コード例 #6
0
        /// <inheritdoc />
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime   started = Started;
            GameTime.GameTime   ended   = Ended;
            OccupationalTieType 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 = (OccupationalTieType)RandomValueGenerator.GenerateIntWithMaxValue(Enum.GetNames(typeof(OccupationalTieType)).Length);
                break;

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

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

            return(copy);
        }