Ejemplo n.º 1
0
    public ActorAction AddAction(ActorAction.ENType newType)
    {
        if (!IsDisable(newType))
        {
            bool isValidateActionState = false;
            for (int index = m_actionList.Count - 1; index >= 0; --index)
            {
                ActorAction item = m_actionList[index];
                if (!item.IsEnable)
                {
                    continue;
                }
                if (ActorAction.ENRelation.enReplace == CheckRelation(newType, item.GetActionType()))
                {
                    m_actionList.RemoveAt(index);
                    isValidateActionState = true;

                    item.OnInterupt();
                    RemoveDisableCount(item.GetActionType());
                    item.IsEnable = false;
                    ReleaseObj(item);
                }
            }
            ActorAction obj = CreateObj(newType);
            obj.CurrentActor = CurrentActor;
            if (null != CurrentActor.mActorBlendAnim)
            {
                CurrentActor.mActorBlendAnim.CurActionType = newType;
            }
            ActioningObjArray[(int)newType] = obj;
            m_actionList.Add(obj);
            AddDisableCount(obj.GetActionType());
            if (isValidateActionState)
            {
                for (int i = 0; i < ActioningArray.Length; i++)
                {
                    ActioningArray[i]    = 0;
                    ActioningObjArray[i] = null;
                }
                for (int i = 0; i < m_actionList.Count; i++)
                {
                    ActorAction ac = m_actionList[i];
                    ActioningObjArray[(int)ac.GetActionType()] = ac;
                    ActioningArray[(int)ac.GetActionType()]++;
                }
            }
            return(obj);
        }
        else
        {
            string currentActions = CurrentActor.GetType() + ":" + newType.ToString() + " Current Actions:";
            foreach (ActorAction action in m_actionList)
            {
                currentActions += action.GetActionType().ToString() + ", ";
            }
            //Debug.LogWarning("Add action failed:" + newType.ToString()+" actor type:"+CurrentActor.Type.ToString());
            return(null);
        }
    }
Ejemplo n.º 2
0
 public void RemoveAction(ActorAction action)
 {
     if (action == null)
     {
         return;
     }
     action.OnInterupt();
     RemoveDisableCount(action.GetActionType());
     m_actionList.Remove(action);
     ReleaseObj(action);
 }
Ejemplo n.º 3
0
    public bool InterruptAction(ActorAction.ENType actionType)
    {
        ActorAction item = LookupAction(actionType);

        if (item != null)
        {
            item.OnInterupt();
            item.IsEnable = false;
            return(true);
        }
        return(false);
    }