예제 #1
0
파일: Ride.cs 프로젝트: hismile06jf/sgqy8
    //
    public override string GetAnimName(EAnimType type)
    {
        switch(type)
        {
        case EAnimType.Idle: return "w_w01";

        case EAnimType.Rest_Down: return "h_r01_1";
        case EAnimType.Rest_Idle: return "h_r01_2";
        case EAnimType.Rest_Idle_a: return "h_r01_3";
        case EAnimType.Rest_Up: return "h_r02";

        case EAnimType.Walk_Fore: return "h_m01";
        case EAnimType.Walk_Back: return "h_m02";
        case EAnimType.Walk_TurnLeft: return "h_m05";
        case EAnimType.Walk_TurnRight: return "h_m06";
        case EAnimType.Walk_Die: return "h_f02_1";
        case EAnimType.Walk_DieHold: return "h_f02_2";

        case EAnimType.Run_Fore: return "h_m03";
        case EAnimType.Run_Back: return "h_m02";
        case EAnimType.Run_RurnLeft: return "h_m05";
        case EAnimType.Run_RurnRight: return "h_m06";
        case EAnimType.Run_Die: return "h_f02_1";
        case EAnimType.Run_DieHold: return "h_f02_2";
        }

        return "w_w01";
    }
    private void HandleInput(out Vector3 direction, ref bool faceToRight, out EAnimType animType)
    {
        direction = Vector3.zero;
        if (Input.GetKey(KeyCode.W))
        {
            direction += new Vector3(0f, 1f, 0f);
        }

        if (Input.GetKey(KeyCode.S))
        {
            direction += new Vector3(0f, -1f, 0f);
        }

        if (Input.GetKey(KeyCode.A))
        {
            direction  += new Vector3(-1f, 0f, 0f);
            faceToRight = false;
        }

        if (Input.GetKey(KeyCode.D))
        {
            direction  += new Vector3(1f, 0f, 0f);
            faceToRight = true;
        }

        if (direction == Vector3.zero)
        {
            animType = EAnimType.fish_man_idle;
        }
        else
        {
            animType = EAnimType.fish_man_walk;
        }
    }
예제 #3
0
 public void HandleAnimationOverrideFX(EAnimType pType, FXArgs pArgs)
 {
     if (m_Effects != null && m_Effects.Contains(pType))
     {
         m_Effects.Load(pType).Configurate(m_AnimationEventHandler, pArgs);
     }
 }
예제 #4
0
        public Single PlayAnimation(EAnimType type, EState changedState, Single duration, Single speed, Single stateExtraTime)
        {
            if (m_AnimationHandler.IsPlaying(EAnimType.DIE) || (m_IsDead && type != EAnimType.DIE))
            {
                m_State.ChangeState(changedState, 0f);
                return(0f);
            }
            AnimationState state = m_AnimationHandler.GetState(type);

            if (state != null)
            {
                if (duration == -1f)
                {
                    duration = state.length / speed;
                }
                m_AnimationHandler.Play(type, duration);
                m_State.ChangeState(changedState, duration + stateExtraTime);
                return(duration);
            }
            m_State.ChangeState(changedState, 0f);
            Debug.LogError(String.Concat(new Object[]
            {
                "Missing '",
                type,
                "' animation!\n",
                name
            }), this);
            return(0f);
        }
        private void ManageSelection(EAnimType a_type, int a_index)
        {
            Event evt = Event.current;

            if (evt.type == EventType.MouseDown && evt.button == 0)
            {
                m_selectionType = a_type;
                m_selectionId   = a_index;
            }
        }
예제 #6
0
    public SkillEffect GetAnimEffect(EAnimType type, bool begin)
    {
        if(null == EffectList) return null;
        SkillEffect effect = null;
        for(int i = 0; i < EffectList.Count; ++i)
        {
            effect = EffectList[i];
            if(null != effect &&
               effect.AnimType == type &&
               effect.EffectBegin == begin)
            {
                return effect;
            }
        }

        return null;
    }
    protected override void OnUpdate()
    {
        ComponentGroupArray <InputComponents> entities = GetEntities <InputComponents>();
        Vector3   direction = Vector3.zero;
        EAnimType animType  = EAnimType.fish_man_idle;

        foreach (InputComponents e in entities)
        {
            bool faceToRight = e.m_direction.m_faceToRight;
            HandleInput(out direction, ref faceToRight, out animType);
            if (e.m_inputComponent.m_isInputEnable)
            {
                e.m_direction.m_direction   = direction;
                e.m_direction.m_faceToRight = faceToRight;
                e.m_sprite.SetAnimType(animType);
            }
        }
    }
예제 #8
0
    //generally human role
    public virtual string GetAnimName(EAnimType type)
    {
        switch(type)
        {
        case EAnimType.Idle: return isRide ? "r_w02" : "w_w02";

        case EAnimType.Rest_Down: return "h_r01_1";
        case EAnimType.Rest_Idle: return "h_r01_2";
        case EAnimType.Rest_Idle_a: return "h_r01_3";
        case EAnimType.Rest_Up: return "h_r02";

        case EAnimType.Walk_Fore: return "h_m01";
        case EAnimType.Walk_Back: return "h_m02";
        case EAnimType.Walk_TurnLeft: return "h_m05";
        case EAnimType.Walk_TurnRight: return "h_m06";
        case EAnimType.Walk_Die: return "h_f02_1";
        case EAnimType.Walk_DieHold: return "h_f02_2";

        case EAnimType.Run_Fore: return "h_m03";
        case EAnimType.Run_Back: return "h_m02";
        case EAnimType.Run_RurnLeft: return "h_m05";
        case EAnimType.Run_RurnRight: return "h_m06";
        case EAnimType.Run_Die: return "h_f02_1";
        case EAnimType.Run_DieHold: return "h_f02_2";

        case EAnimType.Jump_Begin: return "h_f02_2";
        case EAnimType.Jump_Hold: return "h_f02_2";
        case EAnimType.Jump_End: return "h_f02_2";
        case EAnimType.Jump_EndRun: return "h_f02_2";

        case EAnimType.Swim_Fore: return "h_f02_2";
        case EAnimType.Swim_Back: return "h_f02_2";
        case EAnimType.Swim_TurnLeft: return "h_f02_2";
        case EAnimType.Swim_Die: return "h_f02_2";
        case EAnimType.Swim_Die_a: return "h_f02_2";

        //attack
        case EAnimType.Attack_Arrow_Begin: return isRide ? "r_a09_1" : "w_a09_1";
        case EAnimType.Attack_Arrow_Hold: return isRide ? "r_a09_2" : "w_a09_2";
        case EAnimType.Attack_Arrow_Fire: return isRide ? "r_a09_3" : "w_a09_3";
        }

        return "w_w01";
    }
        private void DragDropAnimations(Rect a_dropRect, EAnimType a_type, int a_index)
        {
            Event evt = Event.current;

            switch (evt.type)
            {
            case EventType.DragUpdated:
            case EventType.DragPerform:
            {
                if (!a_dropRect.Contains(evt.mousePosition))
                {
                    return;
                }

                if (DragAndDrop.objectReferences[0].GetType() == typeof(AnimationClip))
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;

                    if (evt.type == EventType.DragPerform)
                    {
                        DragAndDrop.AcceptDrag();

                        UnityEngine.Object obj = DragAndDrop.objectReferences[0];

                        if (obj != null && obj.GetType() == typeof(AnimationClip))
                        {
                            switch (a_type)
                            {
                            case EAnimType.Current:
                            {
                                m_spPrimaryClip.objectReferenceValue = obj;

                                m_data.name = (obj as AnimationClip).name + "_comp";

                                if ((obj as AnimationClip).isLooping)
                                {
                                    m_spLooping.boolValue = true;
                                }

                                m_selectionType = EAnimType.Current;
                                m_selectionId   = 0;

                                m_data.GenerateRootLookupTable();
                            }
                            break;

                            case EAnimType.Future:
                            {
                                if (a_index == m_spAfterClips.arraySize)
                                {
                                    m_spAfterClips.InsertArrayElementAtIndex(a_index);
                                }

                                m_spAfterClips.GetArrayElementAtIndex(a_index).objectReferenceValue = obj;

                                m_selectionType = EAnimType.Future;
                                m_selectionId   = a_index;
                            }
                            break;

                            case EAnimType.Past:
                            {
                                if (a_index == m_spBeforeClips.arraySize)
                                {
                                    m_spBeforeClips.InsertArrayElementAtIndex(a_index);
                                }

                                m_spBeforeClips.GetArrayElementAtIndex(a_index).objectReferenceValue = obj;

                                m_selectionType = EAnimType.Past;
                                m_selectionId   = a_index;
                            }
                            break;
                            }
                            MxMAnimConfigWindow.Inst().Repaint();
                        }
                    }
                }
            }
            break;
            }
        }
        public void OnGUI(Rect a_position)
        {
            if (m_data == null)
            {
                MxMSettings settings = MxMSettings.Instance();
                if (settings != null)
                {
                    m_data = settings.ActiveComposite;

                    if (m_data != null)
                    {
                        SetData(m_data);
                    }
                }
            }

            if (m_data != null)
            {
                Rect  viewRect      = new Rect(0f, 18f, a_position.width, a_position.height - 36f);
                float requiredWidth = (m_data.AnimAfterClips.Count + m_data.AnimBeforeClips.Count + 2) * (s_animSlotSizeSmall + s_animSlotSpacing) + (s_animSlotSize + s_animSlotSpacing);

                if (requiredWidth > a_position.width)
                {
                    Rect scrollRect = new Rect((a_position.width - requiredWidth) / 2f, 18f, Mathf.Max(requiredWidth, a_position.width), a_position.height - 36f);
                    m_scrollPosition = GUI.BeginScrollView(viewRect, m_scrollPosition, scrollRect);
                }

                Rect baseAnimRect = new Rect(a_position.width / 2f - s_animSlotSize / 2f,
                                             a_position.height / 2f - s_animSlotSize / 2f,
                                             s_animSlotSize, s_animSlotSize);

                ManageSlot(baseAnimRect, m_data.PrimaryClip, "\n\n\nPrimary Anim");

                if (m_data.BeforeClips == null)
                {
                    m_data.BeforeClips = new List <AnimationClip>();
                }

                if (m_data.AfterClips == null)
                {
                    m_data.AfterClips = new List <AnimationClip>();
                }

                if (m_data.PrimaryClip != null)
                {
                    if (!m_spLooping.boolValue)
                    {
                        Rect slotRect = new Rect(a_position.width / 2f + s_animSlotSize / 2f + s_animSlotSpacing,
                                                 a_position.height / 2f - s_animSlotSizeSmall / 2f,
                                                 s_animSlotSizeSmall, s_animSlotSizeSmall);

                        for (int i = 0; i < m_data.AfterClips.Count + 1; ++i)
                        {
                            ManageSlot(slotRect, i < m_data.AfterClips.Count ? m_data.AfterClips[i] : null,
                                       "\n\nAfter\nAnim", EAnimType.Future, i);

                            slotRect.x += s_animSlotSizeSmall + s_animSlotSpacing;
                        }

                        slotRect = new Rect(a_position.width / 2f - s_animSlotSize / 2f - s_animSlotSpacing - s_animSlotSizeSmall,
                                            a_position.height / 2f - s_animSlotSizeSmall / 2f,
                                            s_animSlotSizeSmall, s_animSlotSizeSmall);

                        for (int i = 0; i < m_data.BeforeClips.Count + 1; ++i)
                        {
                            ManageSlot(slotRect, i < m_data.BeforeClips.Count ? m_data.BeforeClips[i] : null,
                                       "\n\nBefore\nAnim", EAnimType.Past, i);

                            slotRect.x -= s_animSlotSizeSmall + s_animSlotSpacing;
                        }
                    }

                    Rect settingsRect = new Rect(baseAnimRect.x - s_animSlotSpacing / 2f,
                                                 baseAnimRect.y + baseAnimRect.height + 10f,
                                                 baseAnimRect.width + s_animSlotSpacing,
                                                 baseAnimRect.height * 2f);

                    DrawSettings(settingsRect);
                }

                Event evt = Event.current;

                if (evt.isKey && evt.keyCode == KeyCode.Delete)
                {
                    switch (evt.keyCode)
                    {
                    case KeyCode.Delete:
                    {
                        //Manage delete key
                        switch (m_selectionType)
                        {
                        case EAnimType.Current:
                        {
                            m_spPrimaryClip.objectReferenceValue = null;

                            m_data.ClearRootLookupTable();
                        }
                        break;

                        case EAnimType.Future:
                        {
                            if (m_selectionId < m_spAfterClips.arraySize)
                            {
                                if (m_spAfterClips.GetArrayElementAtIndex(m_selectionId) != null)
                                {
                                    m_spAfterClips.DeleteArrayElementAtIndex(m_selectionId);
                                }

                                m_spAfterClips.DeleteArrayElementAtIndex(m_selectionId);
                            }
                        }
                        break;

                        case EAnimType.Past:
                        {
                            if (m_selectionId < m_spBeforeClips.arraySize)
                            {
                                if (m_spBeforeClips.GetArrayElementAtIndex(m_selectionId) != null)
                                {
                                    m_spBeforeClips.DeleteArrayElementAtIndex(m_selectionId);
                                }

                                m_spBeforeClips.DeleteArrayElementAtIndex(m_selectionId);
                            }
                        }
                        break;
                        }
                    }
                    break;

                    case KeyCode.RightArrow:
                    {
                        NextComposite();
                    }
                    break;

                    case KeyCode.LeftArrow:
                    {
                        LastComposite();
                    }
                    break;
                    }



                    m_selectionType = EAnimType.None;
                    m_selectionId   = 0;

                    MxMAnimConfigWindow.Inst().Repaint();
                }
                if (requiredWidth > a_position.width)
                {
                    GUI.EndScrollView();
                }


                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.Height(20f), GUILayout.ExpandWidth(true));
                if (GUILayout.Button(new GUIContent("Open Timeline"), EditorStyles.toolbarButton))
                {
                    MxMTaggingWindow.ShowWindow();
                }

                if (GUILayout.Button(new GUIContent("Locate Asset"), EditorStyles.toolbarButton))
                {
                    if (m_spTargetPreProcessData.objectReferenceValue != null)
                    {
                        EditorGUIUtility.PingObject(m_spTargetPreProcessData.objectReferenceValue);
                    }

                    if (m_spTargetAnimModule.objectReferenceValue != null)
                    {
                        EditorGUIUtility.PingObject(m_spTargetAnimModule.objectReferenceValue);
                    }
                }

                GUILayout.FlexibleSpace();

                if (GUILayout.Button(EditorGUIUtility.IconContent("back").image, EditorStyles.toolbarButton))
                {
                    LastComposite();
                }

                if (GUILayout.Button(EditorGUIUtility.IconContent("forward").image, EditorStyles.toolbarButton))
                {
                    NextComposite();
                }

                GUILayout.Space(5f);

                if (GUILayout.Button(new GUIContent("Locate Animation"), EditorStyles.toolbarButton))
                {
                    switch (m_selectionType)
                    {
                    case EAnimType.None:
                    case EAnimType.Current:
                    {
                        if (m_spPrimaryClip.objectReferenceValue != null)
                        {
                            EditorGUIUtility.PingObject(m_spPrimaryClip.objectReferenceValue);
                        }
                    }
                    break;

                    case EAnimType.Future:
                    {
                        if (m_selectionId < m_spAfterClips.arraySize)
                        {
                            SerializedProperty spCLip = m_spAfterClips.GetArrayElementAtIndex(m_selectionId);

                            if (spCLip != null && spCLip.objectReferenceValue != null)
                            {
                                EditorGUIUtility.PingObject(spCLip.objectReferenceValue);
                            }
                        }
                    }
                    break;

                    case EAnimType.Past:
                    {
                        if (m_selectionId < m_spBeforeClips.arraySize)
                        {
                            SerializedProperty spCLip = m_spBeforeClips.GetArrayElementAtIndex(m_selectionId);

                            if (spCLip != null && spCLip.objectReferenceValue != null)
                            {
                                EditorGUIUtility.PingObject(spCLip.objectReferenceValue);
                            }
                        }
                    }
                    break;
                    }
                }

                EditorGUILayout.EndHorizontal();
                GUILayout.FlexibleSpace();

                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.Height(20f), GUILayout.ExpandWidth(true));
                EditorGUI.BeginDisabledGroup(true);
                if (m_spTargetPreProcessData.objectReferenceValue != null)
                {
                    EditorGUILayout.ObjectField(m_spTargetPreProcessData, GUILayout.Width(300f));
                }
                else
                {
                    EditorGUILayout.ObjectField(m_spTargetAnimModule, GUILayout.Width(300f));
                }

                GUILayout.FlexibleSpace();

                EditorGUILayout.ObjectField(m_spTargetPrefab, GUILayout.Width(300f));

                EditorGUI.EndDisabledGroup();

                EditorGUILayout.EndHorizontal();
                EditorGUILayout.EndVertical();


                if (m_soData != null)
                {
                    m_soData.ApplyModifiedProperties();
                }
            }
            else
            {
                GUILayout.Space(18f);
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUILayout.LabelField("No Composite Selected.", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
            }
        }
        private void ManageSlot(Rect a_rect, AnimationClip a_clip, string a_defaultName,
                                EAnimType a_animType = EAnimType.Current, int a_index = 0)
        {
            if (a_clip != null)
            {
                Texture2D assetPreview = AssetPreview.GetAssetPreview(a_clip);

                if (assetPreview != null)
                {
                    GUI.DrawTexture(a_rect, assetPreview);
                }

                GUI.Box(a_rect, "\n" + a_clip.name);

                if (m_selectionType == a_animType && a_index == m_selectionId)
                {
                    Handles.color = Color.green;
                }
                else
                {
                    Handles.color = Color.cyan;
                }

                Texture icon       = EditorGUIUtility.IconContent("d_P4_DeletedLocal").image;
                Rect    deleteRect = new Rect(a_rect.x + a_rect.width - 20f, a_rect.y + a_rect.height - 20f, 18f, 18f);

                GUIStyle invisiButton = new GUIStyle(GUI.skin.label);

                if (GUI.Button(deleteRect, icon, invisiButton))
                {
                    if (EditorUtility.DisplayDialog("Delete Clip", "Are you sure you want to delete this clip from the composite?", "Yes", "Cancel"))
                    {
                        if (a_animType == EAnimType.Current)
                        {
                            m_spPrimaryClip.objectReferenceValue = null;
                        }
                        else if (a_animType == EAnimType.Future)
                        {
                            if (a_index < m_spAfterClips.arraySize)
                            {
                                if (m_spAfterClips.GetArrayElementAtIndex(a_index).objectReferenceValue != null)
                                {
                                    m_spAfterClips.DeleteArrayElementAtIndex(a_index);
                                }

                                m_spAfterClips.DeleteArrayElementAtIndex(a_index);
                            }
                        }
                        else if (a_animType == EAnimType.Past)
                        {
                            if (a_index < m_spBeforeClips.arraySize)
                            {
                                if (m_spBeforeClips.GetArrayElementAtIndex(a_index).objectReferenceValue != null)
                                {
                                    m_spBeforeClips.DeleteArrayElementAtIndex(a_index);
                                }

                                m_spBeforeClips.DeleteArrayElementAtIndex(a_index);
                            }
                        }
                    }
                }

                if (CheckHover(a_rect))
                {
                    ManageSelection(a_animType, a_index);
                    Handles.color = Color.yellow;

                    MxMAnimConfigWindow.Inst().Repaint();
                }
            }
            else
            {
                GUI.Box(a_rect, a_defaultName);
                Handles.color = Color.red;
            }


            //Draw highlight box
            Handles.DrawLine(new Vector3(a_rect.xMin, a_rect.yMin), new Vector3(a_rect.xMax, a_rect.yMin));
            Handles.DrawLine(new Vector3(a_rect.xMax, a_rect.yMin), new Vector3(a_rect.xMax, a_rect.yMax));
            Handles.DrawLine(new Vector3(a_rect.xMax, a_rect.yMax), new Vector3(a_rect.xMin, a_rect.yMax));
            Handles.DrawLine(new Vector3(a_rect.xMin, a_rect.yMax), new Vector3(a_rect.xMin, a_rect.yMin));


            DragDropAnimations(a_rect, a_animType, a_index);
        }
예제 #12
0
        private void Play(EAnimType p_type, String p_clipName, Single p_duration, Single p_speed)
        {
            if (m_Animation == null)
            {
                return;
            }
            AnimationState animationState = m_Animation[p_clipName];

            if (animationState != null)
            {
                if (p_type == EAnimType._MAX_)
                {
                    p_type = m_Config.ClipType(p_clipName);
                }
                if (p_type == EAnimType.IDLE)
                {
                    m_EndTime = -1f;
                }
                else
                {
                    m_EndTime  = ((p_duration != -1f) ? p_duration : animationState.length);
                    m_EndTime += Time.time;
                }
                if (m_RootMotionComp != null)
                {
                    m_RootMotionComp.enabled = (p_type == EAnimType.TURN_LEFT || p_type == EAnimType.TURN_RIGHT);
                }
                if (m_Animation.isPlaying)
                {
                    if (m_Animation.IsPlaying(p_clipName))
                    {
                        AnimationState animationState2 = m_Animation.CrossFadeQueued(p_clipName, 0.3f, QueueMode.PlayNow);
                        if (m_RootMotionComp != null)
                        {
                            m_RootMotionComp.AddAnimInfoToTable(animationState2);
                        }
                        animationState2.speed  = p_speed;
                        animationState2.layer += Time.frameCount;
                    }
                    else
                    {
                        m_Animation.CrossFade(p_clipName, 0.3f, PlayMode.StopAll);
                        animationState.speed = p_speed;
                    }
                }
                else
                {
                    m_Animation.Play(p_clipName);
                    animationState.speed = p_speed;
                }
            }
            else
            {
                Debug.LogError(String.Concat(new Object[]
                {
                    "Missing animation ",
                    p_type,
                    " (",
                    p_clipName,
                    ") !!"
                }));
            }
            if (PlayingAnimation != null)
            {
                PlayingAnimation(this, new AnimPlayEventArgs(p_type, p_clipName));
            }
            this.SendEvent("OnPlayAnimation", new PlayAnimationUnityEventArgs(this, p_type, p_clipName));
        }
예제 #13
0
 public void SetAnimType(EAnimType animType)
 {
     m_switch   = (animType != m_animType);
     m_animType = animType;
 }
예제 #14
0
 public Boolean Contains(EAnimType p_type)
 {
     return(!String.IsNullOrEmpty(m_EffectAddOn[(Int32)p_type].m_PrefabPath));
 }
예제 #15
0
 public Single ClipLength(EAnimType type)
 {
     return((type >= (EAnimType)m_AnimationMap.Length || !(m_AnimationMap[(Int32)type] != null)) ? -1f : m_AnimationMap[(Int32)type].length);
 }
예제 #16
0
 public AnimKey(float mark, Vector3 val, EAnimType lt = EAnimType.Linear)
 {
     Mark = mark;
     Val  = val;
     Type = lt;
 }
 public PlayAnimationUnityEventArgs(Object p_sender, EAnimType p_type, String p_clipName) : base(p_sender)
 {
     Type     = p_type;
     ClipName = p_clipName;
 }
예제 #18
0
 public Single PlayAnimation(EAnimType type, EState changedState, Single duration, Single speed)
 {
     return(PlayAnimation(type, changedState, duration, speed, 0f));
 }
예제 #19
0
 public AnimQueueInfo(EAnimType type, string name, bool loaded)
 {
     animType = type;
     animName = name;
     isLoad = loaded;
 }
        private void DragDropAnimations(Rect a_dropRect, EAnimType a_type, int a_index)
        {
            Event evt = Event.current;

            switch (evt.type)
            {
            case EventType.DragUpdated:
            case EventType.DragPerform:
            {
                if (!a_dropRect.Contains(evt.mousePosition))
                {
                    return;
                }

                if (DragAndDrop.objectReferences[0].GetType() == typeof(AnimationClip))
                {
                    DragAndDrop.visualMode = DragAndDropVisualMode.Copy;

                    if (evt.type == EventType.DragPerform)
                    {
                        DragAndDrop.AcceptDrag();

                        Object obj = DragAndDrop.objectReferences[0];

                        if (obj != null && obj.GetType() == typeof(AnimationClip))
                        {
                            switch (a_type)
                            {
                            case EAnimType.Primary:
                            {
                                m_spPrimaryClip.objectReferenceValue = obj;

                                m_data.name = (obj as AnimationClip).name + "_idleSet";

                                m_selectionType = EAnimType.Primary;
                                m_selectionId   = 0;
                            }
                            break;

                            case EAnimType.Secondary:
                            {
                                if (a_index == m_spSecondaryClips.arraySize)
                                {
                                    m_spSecondaryClips.InsertArrayElementAtIndex(a_index);
                                }

                                m_spSecondaryClips.GetArrayElementAtIndex(a_index).objectReferenceValue = obj;

                                m_selectionType = EAnimType.Secondary;
                                m_selectionId   = a_index;
                            }
                            break;

                            case EAnimType.Transition:
                            {
                                if (a_index == m_spTransitionClips.arraySize)
                                {
                                    m_spTransitionClips.InsertArrayElementAtIndex(a_index);
                                }

                                m_spTransitionClips.GetArrayElementAtIndex(a_index).objectReferenceValue = obj;

                                m_selectionType = EAnimType.Transition;
                                m_selectionId   = a_index;
                            }
                            break;
                            }
                            MxMAnimConfigWindow.Inst().Repaint();
                        }
                    }
                }
            } break;
            }
        }
        public void OnGUI(Rect a_position)
        {
            if (m_data == null)
            {
                MxMSettings settings = MxMSettings.Instance();
                if (settings != null)
                {
                    m_data = settings.ActiveIdleSet;

                    if (m_data != null)
                    {
                        SetData(m_data);
                    }
                }
            }

            if (m_data != null)
            {
                Rect  viewRect      = new Rect(0f, 0f, a_position.width, a_position.height);
                float requiredWidth = (Mathf.Max(m_data.TransitionClips.Count, m_data.SecondaryClips.Count) + 1) * (s_animSlotSizeSmall + s_animSlotSpacing);

                if (requiredWidth > a_position.width)
                {
                    Rect scrollRect = new Rect((a_position.width - requiredWidth) / 2f, 18f, Mathf.Max(requiredWidth, a_position.width), a_position.height - 18f);
                    m_scrollPosition = GUI.BeginScrollView(viewRect, m_scrollPosition, scrollRect);
                }

                Rect baseAnimRect = new Rect(a_position.width / 2f - s_animSlotSize / 2f,
                                             a_position.height / 2.5f - s_animSlotSize / 2f,
                                             s_animSlotSize, s_animSlotSize);

                ManageSlot(baseAnimRect, m_data.PrimaryClip, "\n\n\nPrimary Anim");

                if (m_data.SecondaryClips == null)
                {
                    m_data.SecondaryClips = new List <AnimationClip>();
                }

                if (m_data.PrimaryClip != null)
                {
                    Rect slotRect = new Rect(a_position.width / 2f - s_animSlotSizeSmall / 2f - (m_data.TransitionClips.Count
                                                                                                 * (s_animSlotSizeSmall + s_animSlotSpacing)) / 2f,
                                             baseAnimRect.y - s_animSlotSizeSmall - s_animSlotSpacing,
                                             s_animSlotSizeSmall, s_animSlotSizeSmall);


                    EditorGUILayout.BeginHorizontal();
                    GUILayout.Space(Mathf.Max(m_data.TransitionClips.Count, m_data.SecondaryClips.Count) * (s_animSlotSizeSmall + s_animSlotSpacing));
                    EditorGUILayout.EndHorizontal();


                    for (int i = 0; i < m_data.TransitionClips.Count + 1; ++i)
                    {
                        ManageSlot(slotRect, i < m_data.TransitionClips.Count ? m_data.TransitionClips[i] : null,
                                   "\n\nTransition\nAnim", EAnimType.Transition, i);

                        slotRect.x += s_animSlotSizeSmall + s_animSlotSpacing;
                    }


                    slotRect = new Rect(a_position.width / 2f - s_animSlotSizeSmall / 2f - (m_data.SecondaryClips.Count
                                                                                            * (s_animSlotSizeSmall + s_animSlotSpacing)) / 2f,
                                        baseAnimRect.y + s_animSlotSize + s_animSlotSpacing,
                                        s_animSlotSizeSmall, s_animSlotSizeSmall);

                    for (int i = 0; i < m_data.SecondaryClips.Count + 1; ++i)
                    {
                        ManageSlot(slotRect, i < m_data.SecondaryClips.Count ? m_data.SecondaryClips[i] : null,
                                   "\n\nSecondary\nAnim", EAnimType.Secondary, i);

                        slotRect.x += s_animSlotSizeSmall + s_animSlotSpacing;
                    }

                    Rect settingsRect = new Rect(baseAnimRect.x - s_animSlotSpacing / 2f,
                                                 baseAnimRect.y + baseAnimRect.height + s_animSlotSpacing * 2f + s_animSlotSizeSmall,
                                                 baseAnimRect.width + s_animSlotSpacing,
                                                 baseAnimRect.height * 2f);

                    DrawSettings(settingsRect);
                }


                Event evt = Event.current;

                if (evt.isKey && evt.keyCode == KeyCode.Delete)
                {
                    switch (m_selectionType)
                    {
                    case EAnimType.Primary:
                    {
                        m_spPrimaryClip.objectReferenceValue = null;
                    }
                    break;

                    case EAnimType.Secondary:
                    {
                        if (m_selectionId < m_spSecondaryClips.arraySize)
                        {
                            if (m_spSecondaryClips.GetArrayElementAtIndex(m_selectionId).objectReferenceValue != null)
                            {
                                m_spSecondaryClips.DeleteArrayElementAtIndex(m_selectionId);
                            }

                            m_spSecondaryClips.DeleteArrayElementAtIndex(m_selectionId);
                        }
                    }
                    break;

                    case EAnimType.Transition:
                    {
                        if (m_selectionId < m_spTransitionClips.arraySize)
                        {
                            if (m_spTransitionClips.GetArrayElementAtIndex(m_selectionId).objectReferenceValue != null)
                            {
                                m_spTransitionClips.DeleteArrayElementAtIndex(m_selectionId);
                            }

                            m_spTransitionClips.DeleteArrayElementAtIndex(m_selectionId);
                        }
                    }
                    break;
                    }

                    m_selectionType = EAnimType.None;
                    m_selectionId   = 0;

                    MxMAnimConfigWindow.Inst().Repaint();
                }

                if (requiredWidth > a_position.width)
                {
                    GUI.EndScrollView();
                }

                EditorGUILayout.BeginVertical();
                EditorGUILayout.BeginHorizontal(EditorStyles.toolbar, GUILayout.Height(20f), GUILayout.ExpandWidth(true));

                GUILayout.Space(3f);

                if (GUILayout.Button(new GUIContent("Locate Asset"), EditorStyles.toolbarButton))
                {
                    if (m_data != null)
                    {
                        EditorGUIUtility.PingObject(m_data);
                    }
                }

                GUILayout.Space(a_position.width - 190f);

                if (GUILayout.Button(new GUIContent("Locate Animation"), EditorStyles.toolbarButton))
                {
                    if (m_selectionId >= 0)
                    {
                        switch (m_selectionType)
                        {
                        case EAnimType.Primary:
                        {
                            if (m_spPrimaryClip.objectReferenceValue != null)
                            {
                                EditorGUIUtility.PingObject(m_spPrimaryClip.objectReferenceValue);
                            }
                        }
                        break;

                        case EAnimType.Secondary:
                        {
                            if (m_spSecondaryClips.arraySize > m_selectionId)
                            {
                                SerializedProperty spAnim = m_spSecondaryClips.GetArrayElementAtIndex(m_selectionId);

                                if (spAnim != null && spAnim.objectReferenceValue != null)
                                {
                                    EditorGUIUtility.PingObject(spAnim.objectReferenceValue);
                                }
                                else
                                {
                                    if (m_spPrimaryClip.objectReferenceValue != null)
                                    {
                                        EditorGUIUtility.PingObject(m_spPrimaryClip.objectReferenceValue);
                                    }
                                }
                            }
                        }
                        break;

                        case EAnimType.Transition:
                        {
                            if (m_spTransitionClips.arraySize > m_selectionId)
                            {
                                SerializedProperty spAnim = m_spTransitionClips.GetArrayElementAtIndex(m_selectionId);

                                if (spAnim != null && spAnim.objectReferenceValue != null)
                                {
                                    EditorGUIUtility.PingObject(spAnim.objectReferenceValue);
                                }
                                else
                                {
                                    if (m_spPrimaryClip.objectReferenceValue != null)
                                    {
                                        EditorGUIUtility.PingObject(m_spPrimaryClip.objectReferenceValue);
                                    }
                                }
                            }
                        }
                        break;
                        }
                    }
                    else
                    {
                        if (m_spPrimaryClip.objectReferenceValue != null)
                        {
                            EditorGUIUtility.PingObject(m_spPrimaryClip.objectReferenceValue);
                        }
                    }
                }


                if (m_soData != null)
                {
                    m_soData.ApplyModifiedProperties();
                }
            }
            else
            {
                GUILayout.Space(18f);
                EditorGUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUILayout.LabelField("No Idle Set Selected.", EditorStyles.boldLabel);
                GUILayout.FlexibleSpace();
                EditorGUILayout.EndHorizontal();
            }
        }
예제 #22
0
 public Boolean IsClipDefined(EAnimType type)
 {
     return(type < (EAnimType)m_AnimationMap.Length && m_AnimationMap[(Int32)type] != null);
 }
예제 #23
0
 public FXDescription Load(EAnimType p_type)
 {
     return(m_EffectAddOn[(Int32)p_type].Load());
 }
예제 #24
0
        public void Play(EAnimType p_type)
        {
            String p_clipName = m_Config.ClipName(p_type);

            Play(p_type, p_clipName, -1f, 1f);
        }
예제 #25
0
    /*  begin:true开始播放,false结束播放  */
    void OnSkillAnimPlayCallBack(EAnimType animType, bool begin)
    {
        if(null == currSkill) return;

        //play effect

        SkillEffect skillEffect = currSkill.GetAnimEffect(animType, begin);
        if(null != skillEffect)
        {
            Transform target = null;
            Vector3 vPos = Vector3.zero;
            EHardPoint targetHP = EHardPoint.Back;
            if(skillEffect.SkillEffectType == ESkillEffectType.User ||
               skillEffect.SkillFireSrc == ESkillFireSrc.Role )
            {
                if(!IsMainBodyReady)
                {
                    Debug.LogError("SkillEffectType == User, but main body not ready.");
                    return;
                }
                target = MainBodyObj.transform;
                targetHP = skillEffect.TargetHardPoint;
            }
            else if(skillEffect.SkillEffectType == ESkillEffectType.Target)
            {
                if(!IsMainBodyReady)
                {
                    Debug.LogError("SkillEffectType == Target, but Target not select.");
                    return;
                }
                target = SelectTarget.transform;
                targetHP = skillEffect.TargetHardPoint;
            }
            else if(skillEffect.SkillEffectType == ESkillEffectType.SelectPlace)
            {
                vPos = SelectTargetPostion;
            }
            else if(skillEffect.SkillEffectType == ESkillEffectType.TrackTarget)
            {
                if(skillEffect.SkillFireSrc == ESkillFireSrc.WeaponLeft)
                {
                    GameObject weaponObj = GetAttachGameObject(GetHardPointName(EHardPoint.LeftHand));
                    if(null == weaponObj)
                    {
                        Debug.LogError("SkillFireSrc == WeaponLeft, but weaponObj not ready.");
                        return;
                    }
                    target = weaponObj.transform;
                    targetHP = skillEffect.SkillFireSrcHardPoint;
                }
                else if(skillEffect.SkillFireSrc == ESkillFireSrc.WeaponRight)
                {
                    GameObject weaponObj = GetAttachGameObject(GetHardPointName(EHardPoint.RightHand));
                    if(null == weaponObj)
                    {
                        Debug.LogError("SkillFireSrc == WeaponRight, but weaponObj not ready.");
                        return;
                    }
                    target = weaponObj.transform;
                    targetHP = skillEffect.SkillFireSrcHardPoint;
                }
                else if(skillEffect.SkillFireSrc == ESkillFireSrc.Ride)
                {
                    if(null == ride || !ride.IsMainBodyReady)
                    {
                        Debug.LogError("SkillFireSrc == Ride, but ride not ready.");
                        return;
                    }
                    target = ride.MainBodyObj.transform;
                    targetHP = skillEffect.SkillFireSrcHardPoint;
                }
            }

            if(null != target)
            {
                Transform hp = GetHardPoint(target, GetHardPointName(targetHP));
                if(null != hp) target = hp;
            }

            EffectUtility.PlayEffect(skillEffect.EffectFile, skillEffect.EffectTime, target, vPos, skillEffect, OnSkillFxPlayCallBack);
        }
    }
예제 #26
0
        public void Play(EAnimType p_type, Single p_duration, Single p_speed)
        {
            String p_clipName = m_Config.ClipName(p_type);

            Play(p_type, p_clipName, p_duration, p_speed);
        }
예제 #27
0
 public void PlayAnim(EAnimType anim)
 {
     string animName = GetAnimName(anim);
     PlayAnim(animName);
 }
예제 #28
0
 public String ClipName(EAnimType type)
 {
     return((type >= (EAnimType)m_AnimationMap.Length || !(m_AnimationMap[(Int32)type] != null)) ? null : m_AnimationMap[(Int32)type].name);
 }
예제 #29
0
 public Boolean IsPlaying(EAnimType p_type)
 {
     return(m_Animation.IsPlaying(m_Config.ClipName(p_type)));
 }
예제 #30
0
        public AnimationState GetState(EAnimType p_type)
        {
            String name = m_Config.ClipName(p_type);

            return(m_Animation[name]);
        }
예제 #31
0
 public AnimPlayEventArgs(EAnimType p_type, String p_clipName)
 {
     Type     = p_type;
     ClipName = p_clipName;
 }
예제 #32
0
 private String GetAudioID(EAnimType p_Type)
 {
     return(m_monsterAudioPrefix + p_Type.ToString().ToLowerInvariant());
 }