Exemple #1
0
 private void OnSubCommondComplate(CommandNode command)
 {
     --m_ComplateCommandCount;
     if (m_ComplateCommandCount == 0)
     {
         FinishCommand();
     }
 }
Exemple #2
0
 public void Add(CommandNode command)
 {
     if (m_GuideCommandList == null)
     {
         m_GuideCommandList = new List <CommandNode>();
     }
     m_GuideCommandList.Add(command);
 }
Exemple #3
0
 private void OnSubCommondComplate(CommandNode command)
 {
     m_RuntimeCurrentNode = command.nextCommand;
     if (m_RuntimeCurrentNode == null)
     {
         FinishCommand();
     }
     else
     {
         m_RuntimeCurrentNode.Start();
     }
 }
Exemple #4
0
 public override void Start()
 {
     if (m_FirstCommand != null)
     {
         m_RuntimeCurrentNode = m_FirstCommand;
         m_RuntimeCurrentNode.Start();
     }
     else
     {
         FinishCommand();
     }
 }
Exemple #5
0
        public CommandSequence Append(CommandNode command)
        {
            if (m_CurrentCommand == null)
            {
                m_CurrentCommand = command;
                m_FirstCommand   = m_CurrentCommand;
            }
            else
            {
                m_CurrentCommand.nextCommand = command;
                m_PreCommand     = m_CurrentCommand;
                m_CurrentCommand = command;
            }
            m_CurrentCommand.SetCommandNodeEventListener(OnSubCommondComplate);

            return(this);
        }
Exemple #6
0
        public CommandSequence Join(CommandNode command)
        {
            CommandGroup group;

            if (m_CurrentCommand == null)
            {
                group = new CommandGroup();
                m_CurrentCommand.SetCommandNodeEventListener(OnSubCommondComplate);
                m_CurrentCommand = group;
                m_FirstCommand   = m_CurrentCommand;
            }
            else
            {
                if (m_CurrentCommand.GetType() == typeof(CommandGroup))
                {
                    group = m_CurrentCommand as CommandGroup;
                }
                else
                {
                    if (m_FirstCommand == m_CurrentCommand)
                    {
                        m_FirstCommand = null;
                    }

                    group = new CommandGroup();
                    group.SetCommandNodeEventListener(OnSubCommondComplate);
                    if (m_PreCommand != null)
                    {
                        m_PreCommand.nextCommand = group;
                    }
                    m_CurrentCommand.SetCommandNodeEventListener(null);
                    group.Add(m_CurrentCommand);
                    m_CurrentCommand = group;

                    if (m_FirstCommand == null)
                    {
                        m_FirstCommand = m_CurrentCommand;
                    }
                }
            }

            group.Add(command);

            return(this);
        }