Beispiel #1
0
        internal void WakeUp(IMemoryFileController fileController, bool useMemoryBackupAsFailsafe = false)
        {
            var memory = fileController.ReadFromFile(UniqueId, useMemoryBackupAsFailsafe);

            if (memory == null)
            {
                throw new RnpcMemoryException("Memory file could not be loaded for character with guid" + UniqueId);
            }

            MyMemory = memory;
        }
Beispiel #2
0
        private int _wakingProbability = 100;    //TODO
        #endregion

        #region Constructor and Character Initialization, Sleep and Hibernate

        /// <summary>
        /// Character constructor.
        /// This is nature. It can be changed by nurture.
        /// </summary>
        /// <param name="allAboutMe">Hey, who am I, really? What's my name, my gender, stuff like that. Let me know.</param>
        /// <param name="archetype">Is my character inspired by an archetype,
        /// or am I a product of pure randomness (null/empty value)</param>
        /// <param name="commonKnowledgeContent">The character's basic knowledge</param>
        public Character(Person allAboutMe, Archetype archetype, List <MemoryItem> commonKnowledgeContent = null)
        {
            UniqueId = Guid.NewGuid();
            if (allAboutMe == null)
            {
                throw new ArgumentNullException(ErrorMessages.IHaveNoPersonality);
            }

            if (string.IsNullOrEmpty(allAboutMe.Name))
            {
                throw new ArgumentNullException(ErrorMessages.IHaveNoName);
            }

            MyTraits = new CharacterTraits(allAboutMe.Name, allAboutMe.Sex, allAboutMe.Orientation, allAboutMe.Gender);
            InitializeTraits(archetype);

            MyTraits.ImTired += ImTiredNow;

            MyMemory = new Memory.Memory(allAboutMe);
            AddContentToLongTermMemory(commonKnowledgeContent);
        }