GameFramework.Story.Commands.WaitStoryCommand.ExecCommand C# (CSharp) Method

ExecCommand() protected method

protected ExecCommand ( StoryInstance instance, long delta ) : bool
instance StorySystem.StoryInstance
delta long
return bool
        protected override bool ExecCommand(StoryInstance instance, long delta)
        {
            bool ret = false;
            Scene scene = instance.Context as Scene;
            if (null != scene) {
                int ct = 0;
                for (int i = 0; i < m_StoryIds.Count; i++) {
                    ct += scene.StorySystem.CountStory(m_StoryIds[i].Value);
                }
                if (ct <= 0) {
                    string varName = m_SetVar.Value;
                    object varVal = m_SetVal.Value;
                    instance.SetVariable(varName, varVal);
                } else {
                    int timeout = m_TimeoutVal.Value;
                    int curTime = m_CurTime;
                    m_CurTime += (int)delta;
                    if (timeout <= 0 || curTime <= timeout) {
                        ret = true;
                    } else {
                        string varName = m_TimeoutSetVar.Value;
                        object varVal = m_TimeoutSetVal.Value;
                        instance.SetVariable(varName, varVal);
                    }
                }
            }
            return ret;
        }