Пример #1
0
    public void AddAction(MtAction action, Transform target, bool paused)
    {
        Debug.Assert(action != null, "action can't be null!");
        Debug.Assert(target != null, "target can't be null!");
        if (action == null || target == null)
        {
            return;
        }

        MtActionElement element = null;

        if (!m_dicActionElement.ContainsKey(target))
        {
            element         = new MtActionElement();
            element.paused  = paused;
            element.target  = target;
            element.actions = new ArrayList();
            LinkedListNode <MtActionElement> listNode = new LinkedListNode <MtActionElement>(element);
            m_dicActionElement.Add(target, listNode);
            m_targets.AddLast(listNode);
        }
        else
        {
            element = m_dicActionElement[target].Value;
        }
//		Debug.Assert(!element.actions.Contains(action), "Action already be added!");
        if (!element.actions.Contains(action))
        {
            element.actions.Add(action);
            action.StartWithTarget(target);
        }
    }