fBaseXtensions.XML.WhileActorExists.GetConditionExec C# (CSharp) Method

GetConditionExec() public method

public GetConditionExec ( ) : bool
return bool
        public override bool GetConditionExec()
        {
            if (ObjectCache.ShouldUpdateObjectCollection)
                ObjectCache.UpdateCacheObjectCollection();

            if (!_InitLogicChecking)
            {
                Logger.DBLog.DebugFormat("WhileActorExists Init Logic Checks!");
                _InitLogicChecking = true;

                bool objectCurrentlyPresent = ObjectCache.Objects.Values.Any(o => o.SNOID == Sno);

                if (Present && objectCurrentlyPresent)
                {
                    ObjectCache.Objects.OnObjectRemovedFromCollection += OnObjectRemoved;
                    Logger.DBLog.DebugFormat("WhileActorExists Hooked Object Removed Event!");
                }
                else if (!Present && !objectCurrentlyPresent)
                {
                    ObjectCache.Objects.OnObjectAddedToCollection += OnObjectAdded;
                    Logger.DBLog.DebugFormat("WhileActorExists Hooked Object Added Event!");
                }
                else if (!Present && objectCurrentlyPresent)
                {
                    //Object contained in cache -- and we are checking if its not.
                    _ConditionSuccessSkip = false;
                }
                else if (Present && !objectCurrentlyPresent)
                {
                    //Object not contained in cache -- and we are checking if it is.
                    _ConditionSuccessSkip = false;
                }

                if (!_ConditionSuccessSkip)
                    Logger.DBLog.DebugFormat("WhileActorExists Finished during init!");
            }

            return _ConditionSuccessSkip;

            //return !Present ? !ObjectCache.Objects.Values.Any(o => o.SNOID == Sno) : ObjectCache.Objects.Values.Any(o => o.SNOID == Sno);
            //return !FunkyGame.Hero.bIsInTown;
        }