Exemplo n.º 1
0
        /// <summary>
        ///     Removes the element associated with the specified identifier.
        /// </summary>
        /// <typeparam name="TElement">
        ///     The type of the element.
        /// </typeparam>
        /// <param name="id">
        ///     The reference identifier.
        /// </param>
        public static void RemoveItem <TElement>(int id)
        {
            if (!CacheProvider <TElement> .Storage.ContainsKey(id))
            {
                return;
            }
            lock (SyncObject)
            {
                var item = (object)CacheProvider <TElement> .Storage[id];
                CacheProvider <TElement> .Storage.Remove(id);

                CurrentMemory.Destroy(ref item);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// ITypicalAgent
        /// </summary>
        public virtual void StateRecompute()
        {
            logger.Trace("Base state recomputing for {0}", this);

            PerformFeedback();
            CurrentState.Reduct();

            if (CurrentState.Health.CurrentUnitValue == this.CurrentState.Health.MinValue)
            {
                HomeWorld.AskWorldForEuthanasia(this);
            }
            foreach (ActionAbstract act in CurrentVision.CurrentViewActions)
            {
                CurrentMemory.StoreAction(act.Subject, act);
            }

            logger.Debug("Base state recomputed for {0}", this.Name);
            logger.Trace("{0}", this);
        }