コード例 #1
0
 public void DoActionImmediately(PEActionType type, PEActionParam para = null)
 {
     if (HasAction(type))
     {
         if (IsActionRunning(type))
         {
             m_ActionDic[(int)type].ResetAction(para);
         }
         else
         {
             if (null != m_SkEntity._net)
             {
                 ((SkNetworkInterface)m_SkEntity._net).SendDoAction(type, para);
             }
             ActionRelationData data = ActionRelationData.GetData(type);
             if (null != onActionStart)
             {
                 onActionStart(type);
             }
             RunningAction runningAction = GetRunningAction();
             runningAction.Do(m_ActionDic[(int)type], data, para, true);
             m_RunningAction[(int)type] = runningAction;
         }
     }
 }
コード例 #2
0
        public bool DoAction(PEActionType type, PEActionParam para = null)
        {
            if (HasAction(type))
            {
                if (IsActionRunning(type))
                {
//					if(null != m_SkEntity._net)
//						((SkNetworkInterface)m_SkEntity._net).SendDoAction(type,para);
                    m_ActionDic[(int)type].ResetAction(para);
                    return(true);
                }
                else if (m_ActionDic[(int)type].CanDoAction(para))
                {
                    ActionRelationData data = ActionRelationData.GetData(type);
                    if (null == data)
                    {
                        return(false);
                    }

                    if (CheckDepend(data))
                    {
                        if (null != m_SkEntity._net)
                        {
                            ((SkNetworkInterface)m_SkEntity._net).SendDoAction(type, para);
                        }

                        if (null != onActionStart)
                        {
                            onActionStart(type);
                        }
                        RunningAction runningAction = GetRunningAction();
                        runningAction.Do(m_ActionDic[(int)type], data, para, false);
                        m_RunningAction[(int)type] = runningAction;
                                                #if UNITY_EDITOR
                        if (ShowLog)
                        {
                            Debug.LogError("DoAction: " + type.ToString());
                        }
                                                #endif
                        return(true);
                    }
                }
            }
            return(false);
        }