コード例 #1
0
        public static PropertiesSkill GetOrAddSkill(this Biota biota, Skill skill, ReaderWriterLockSlim rwLock, out bool skillAdded)
        {
            rwLock.EnterWriteLock();
            try
            {
                if (biota.PropertiesSkill != null && biota.PropertiesSkill.TryGetValue(skill, out var value))
                {
                    skillAdded = false;
                    return(value);
                }

                if (biota.PropertiesSkill == null)
                {
                    biota.PropertiesSkill = new Dictionary <Skill, PropertiesSkill>();
                }

                var entity = new PropertiesSkill();
                biota.PropertiesSkill[skill] = entity;
                skillAdded = true;

                return(entity);
            }
            finally
            {
                rwLock.ExitWriteLock();
            }
        }
コード例 #2
0
ファイル: PropertiesSkill.cs プロジェクト: jacobtipp/trACE
        public PropertiesSkill Clone()
        {
            var result = new PropertiesSkill
            {
                LevelFromPP           = LevelFromPP,
                SAC                   = SAC,
                PP                    = PP,
                InitLevel             = InitLevel,
                ResistanceAtLastCheck = ResistanceAtLastCheck,
                LastUsedTime          = LastUsedTime,
            };

            return(result);
        }