public void removeMoverAction(ActionTypeFlag moverAction) { Mover mover; if (m_actionMovers.Dictionary.TryGetValue(moverAction, out mover) && mover != null) { mover.deInit(); } m_actionMovers.Dictionary.Remove(moverAction); }
////////////////////////////////////////////////////////////////////////////////////////// #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); } }
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); }
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); } }
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); } } }
public void setActionTypeFlags(ActionTypeFlag actionTypeFlags) { m_actionTypeFlags = actionTypeFlags; }