Пример #1
0
 void TriggerEvent(AIClipEvent clipEvent)
 {
     if (clipEvent is SetVelocityEvent)
     {
         SetVelocityEvent velocityEvent = clipEvent as SetVelocityEvent;
         mOwner.SetExtrenalVelocity(velocityEvent.velocity);
     }
     else if (clipEvent is ShowEffectEvent)
     {
         ShowEffectEvent effectEvent = clipEvent as ShowEffectEvent;
         Object          obj         = Resources.Load(effectEvent.effectName);
         if (obj)
         {
             Vector3 pos = mOwner.transform.TransformPoint(effectEvent.startPosition);
             Object.Instantiate(obj, pos, Quaternion.identity);
         }
     }
     else if (clipEvent is AiActionEvent)
     {
         ConductAIAction(clipEvent as AiActionEvent);
     }
     else
     {
         Debug.LogError("未实现的事件类型" + clipEvent);
     }
 }
Пример #2
0
    public static void OpenAsEditMode(AIClipEvent clipEvent)
    {
        AIEventEditWnd wnd = EditorWindow.GetWindow <AIEventEditWnd>();

        wnd.OpenAsCreateMode();
        wnd.mCurEvet = clipEvent;
    }
Пример #3
0
 public void Update()
 {
     for (int i = 0; i < eventList.Count; i++)
     {
         AIClipEvent clipEvent = eventList[i];
         if (mOwner.CurClipTime > clipEvent.triggerTime)
         {
             TriggerEvent(clipEvent);
             eventList.Remove(clipEvent);
         }
     }
 }
Пример #4
0
 public static void SelectAIClip(AIClip aiClip)
 {
     if (selectedAiClip != aiClip)
     {
         selectedAiClip = aiClip;
         //要保证选择AI片断后自动选择这个片断所在的AI组
         selecteClipGroup = FindOwnerClipGroup(aiClip);
         mSelectedLink    = null;
         selectedHitData  = null;
         aiEvent          = null;
     }
 }
Пример #5
0
 void CreateEvent(AIClipEvent clipEvent)
 {
     if (onCreate != null)
     {
         onCreate(clipEvent);
         //初始名为赋值为类型名
         clipEvent.eventName = clipEvent.ToString();
         mCurEvet = clipEvent;
         onCreate = null;
     }
     else
     {
         Debug.LogError("没有创建回调");
     }
 }
Пример #6
0
 void CreateEvent(AIClipEvent clipEvent)
 {
     if (onCreate != null)
     {
         onCreate(clipEvent);
         //初始名为赋值为类型名
         clipEvent.eventName = clipEvent.ToString();
         mCurEvet            = clipEvent;
         onCreate            = null;
     }
     else
     {
         Debug.LogError("没有创建回调");
     }
 }
Пример #7
0
 void TriggerEvent(AIClipEvent clipEvent)
 {
     if (clipEvent is SetVelocityEvent)
     {
         SetVelocityEvent velocityEvent = clipEvent as SetVelocityEvent;
         mOwner.SetExtrenalVelocity(velocityEvent.velocity);
     }else if (clipEvent is ShowEffectEvent)
     {
         ShowEffectEvent effectEvent = clipEvent as ShowEffectEvent;
         Object obj= Resources.Load(effectEvent.effectName);
         if (obj)
         {
             Vector3 pos = mOwner.transform.TransformPoint(effectEvent.startPosition);
             Object.Instantiate(obj, pos, Quaternion.identity);
         }
     }else if (clipEvent is AiActionEvent)
     {
         ConductAIAction(clipEvent as AiActionEvent);
     }
     else
     {
         Debug.LogError("未实现的事件类型"+clipEvent);
     }
 }
Пример #8
0
 public static void SelectedAIEvent(AIClipEvent clipEvent)
 {
     aiEvent = clipEvent;
 }
Пример #9
0
 public void OpenAsCreateMode()
 {
     mCurEvet = null;
 }
Пример #10
0
 public void OpenAsCreateMode()
 {
     mCurEvet = null;
 }
Пример #11
0
 public static void OpenAsEditMode(AIClipEvent clipEvent)
 {
     AIEventEditWnd wnd = EditorWindow.GetWindow<AIEventEditWnd>();
     wnd.OpenAsCreateMode();
     wnd.mCurEvet = clipEvent;
 }
Пример #12
0
 public static void SelectedAIEvent(AIClipEvent clipEvent)
 {
     aiEvent = clipEvent;
 }
Пример #13
0
 public static void SelectAIClip(AIClip aiClip)
 {
     if (selectedAiClip != aiClip)
     {
         selectedAiClip = aiClip;
         //要保证选择AI片断后自动选择这个片断所在的AI组
         selecteClipGroup = FindOwnerClipGroup(aiClip);
         mSelectedLink = null;
         selectedHitData = null;
         aiEvent = null;
     }
 }
Пример #14
0
    /// <summary>
    /// 绘制片断时间列表
    /// </summary>
    /// <param name="clip"></param>
    public static void DrawAiEvetList(AIClip clip)
    {
        GUILayout.BeginHorizontal();
        GUILayout.Label("事件列表", GUILayout.Width(60));
        #region copy and paste icons
        if (GUILayout.Button(AIFGUISKin.IconCopy, GUILayout.Width(30), GUILayout.Height(30)))
        {
            if (AIDataSelection.aiEvent != null)
            {
                CustomClipBoard.CopyData(AIDataSelection.aiEvent);
            }
        }
        if (GUILayout.Button(AIFGUISKin.IconPaste, GUILayout.Width(30), GUILayout.Height(30)))
        {
            object clipBoardObj;
            CustomClipBoard.GetCopyObject(out clipBoardObj);
            if (clipBoardObj == null)
            {
                Debug.LogError("剪切板没有内容可以粘贴");
            }
            else
            {
                clipBoardObj = Utility.XmlDeepCloneObject(clipBoardObj);

                if (clipBoardObj is AIClipEvent)
                {
                    clip.AiClipEvents.Add(clipBoardObj as AIClipEvent);
                }
            }
        }
        #endregion
        if (GUILayout.Button(AIFGUISKin.IconNewItem, GUILayout.Width(30), GUILayout.Height(30)))
        {
            AIEventEditWnd.OpenCreateEditor(delegate(AIClipEvent e)
            {
                clip.AiClipEvents.Add(e);
            });
        }
        GUILayout.EndHorizontal();
        if (clip.AiClipEvents.Count == 0)
        {
            GUILayout.Label("事件列表为空");
        }
        else
        {
            for (int i = 0; i < clip.AiClipEvents.Count; i++)
            {
                AIClipEvent evet = clip.AiClipEvents[i];
                GUILayout.BeginHorizontal();
                Color col = AIDataSelection.aiEvent == evet ? Color.green : GUI.color;
                if (AIFUIUtility.LayoutButtonWithColor(evet.eventName, col, 150))
                {
                    AIDataSelection.SelectedAIEvent(evet);
                    AIEventEditWnd.OpenAsEditMode(evet);
                }
                if (GUILayout.Button("X", GUILayout.Width(30)))
                {
                    if (EditorUtility.DisplayDialog("警告", "确定删除事件吗", "确定", "取消"))
                    {
                        clip.AiClipEvents.Remove(evet);
                        return;
                    }
                }
                GUILayout.EndHorizontal();
            }
        }
    }