Пример #1
0
    public void removeMoverAction(ActionTypeFlag moverAction)
    {
        Mover mover;

        if (m_actionMovers.Dictionary.TryGetValue(moverAction, out mover) && mover != null)
        {
            mover.deInit();
        }
        m_actionMovers.Dictionary.Remove(moverAction);
    }
Пример #2
0
    //////////////////////////////////////////////////////////////////////////////////////////
    #region Methods
    //////////////////////////////////////////////////////////////////////////////////////////

    public void createMoverAction(ActionTypeFlag moverAction)
    {
        Mover mover;

        if (!m_actionMovers.Dictionary.TryGetValue(moverAction, out mover) || mover == null)
        {
            mover = new Mover();
            m_actionMovers.Dictionary.Add(moverAction, mover);
        }
    }
Пример #3
0
    public Mover.State getActionState(ActionTypeFlag actionTypeFlag)
    {
        Mover.State state = Mover.State.Undefined;
        Mover       mover;

        if (m_actionMovers.Dictionary.TryGetValue(actionTypeFlag, out mover))
        {
            state = mover.getState();
        }
        return(state);
    }
Пример #4
0
    public void activateMoverAction(ActionTypeFlag actionTypeFlag)
    {
        Mover mover;

        if (!m_actionMovers.Dictionary.TryGetValue(actionTypeFlag, out mover))
        {
            Debug.Assert(false, "Could not find a mover for " + actionTypeFlag.ToString() + ". Default mover is created but may not behave as expected.");
            createMoverAction(actionTypeFlag);
            mover = m_actionMovers.Dictionary[actionTypeFlag];
        }
        if (!mover.getState().Equals(Mover.State.Active))
        {
            m_activeActionMovers.AddLast(mover);
            mover.beginMove(m_transformComponent);
        }
    }
Пример #5
0
    protected virtual void initialize()
    {
        if (m_transformComponent == null)
        {
            m_transformComponent = GetComponent <Transform>();
        }
        if (!m_alwaysUpdate)
        {
            this.enabled = false;
        }

        int actionTypeFlagCount = System.Enum.GetValues(typeof(ActionTypeFlag)).Length;

        for (int i = 0; i < actionTypeFlagCount; ++i)
        {
            ActionTypeFlag mask = (ActionTypeFlag)(1 << i);
            ActionTypeFlag maskedActionTypeFlag = mask & m_actionTypeFlags;
            if (maskedActionTypeFlag != 0)
            {
                activateMoverAction(maskedActionTypeFlag);
            }
        }
    }
Пример #6
0
 public void setActionTypeFlags(ActionTypeFlag actionTypeFlags)
 {
     m_actionTypeFlags = actionTypeFlags;
 }