コード例 #1
0
ファイル: PastEvent.cs プロジェクト: FrederykMtl/RNPC.NetCore
        /// <summary>
        /// Returns a copy of the object with all the information copied inaccurately
        /// this represents the character having wrong information
        /// </summary>
        /// <returns>Item with the information</returns>
        public override MemoryItem GetInaccurateCopy()
        {
            GameTime.GameTime started = Started;
            GameTime.GameTime ended   = Ended;
            PastEventType     type    = Type;

            //TODO : Randomize name

            int falsificationCase = RandomValueGenerator.GenerateIntWithMaxValue(4);

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

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

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

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

            var copy = new PastEvent(Name, ReferenceId, Description, started, ended)
            {
                ItemType           = ItemType,
                _linkedPlaces      = _linkedPlaces,
                _linkedEvents      = _linkedEvents,
                _linkedOccupations = _linkedOccupations,
                _linkedPersons     = _linkedPersons,
                Type = type
            };

            return(copy);
        }
コード例 #2
0
 public List <PastEvent> FindEventsByTypeAndRelatedPerson(PastEventType type, Person relatedPerson)
 {
     return(_parent._longTermMemory.Where(e => e.ItemType == MemoryItemType.PastEvent).Cast <PastEvent>().Where(p => p.IsPersonAssociatedWithThisEvent(relatedPerson.Name)).ToList());
 }
コード例 #3
0
 public List <PastEvent> FindEventsByType(PastEventType type)
 {
     return(_parent._longTermMemory.Where(e => e.ItemType == MemoryItemType.PastEvent).Cast <PastEvent>().Where(p => p.Type == type).ToList());
 }