コード例 #1
0
        internal void RewriteKnowledges(Dictionary <string, uint> newKnowledges)
        {
            var allKnowledges = newKnowledges.Where(t => t.Value > 0).Select(t =>
            {
                Knowledges knowledge;
                var knowledgeExist = Knowledges.TryParse(t.Key, true, out knowledge);
                return(new
                {
                    t.Key,
                    KnKey = knowledge,
                    KnowledgeExist = knowledgeExist,
                    t.Value
                });
            }).ToList();

            _knowledgeses = allKnowledges.Where(t => t.KnowledgeExist).ToDictionary(t => t.KnKey, t => t.Value);
            _knowledgeses[Knowledges.Nothing] = 100;

            _ObjectKnowledgeses = _ObjectKnowledgeses.Join(allKnowledges.Where(t => !t.KnowledgeExist), t => t.Key, u => u.Key,
                                                           (pair, kn) => new KeyValuePair <string, uint>(pair.Key, kn.Value))
                                  .ToDictionary(pair => pair.Key, pair => pair.Value);

            HeroLifeCycle.NextGen();

            _stateQueue.Clear();
            StateEvent.FireEvent();
        }
コード例 #2
0
        public override bool CheckForUnExpected()
        {
            if (HeroLifeCycle.HeroProperties.Health <= 0 && !(State is Halting) && !(State is Halt))
            {
                Halt();
                return(false);
            }

            if (HeroLifeCycle.TotallyTired() && !(State is Unconscios))
            {
                FallUnconscios();
                return(false);
            }

            return(true);
        }
コード例 #3
0
 internal void AddEffect(IEffect effect)
 {
     HeroLifeCycle.AddEffect(effect);
 }
コード例 #4
0
 public void Eat(int satiety)
 {
     HeroLifeCycle.Eat(satiety);
 }