Ejemplo n.º 1
0
        /// <summary>
        /// Starts running the sequence with the given name.
        /// Returns if it was able to start.
        /// </summary>
        public bool Run(string inID)
        {
            Generator generator;

            if (m_Generators.TryGetValue(inID, out generator))
            {
                if (generator.Behavior != ConcurrentBehavior.Allow)
                {
                    SequenceData runningAlready = FindSequence(inID);
                    if (runningAlready != null)
                    {
                        if (generator.Behavior == ConcurrentBehavior.Restart)
                        {
                            runningAlready.Stop();
                        }
                        else
                        {
                            return(false);
                        }
                    }
                }

                SequenceData data = SequenceData.Create(inID, this, generator.Function());
                m_RunningSequences.Add(data);
                data.Start();
                return(true);
            }

            return(false);
        }