Exemple #1
0
    public void ClientAnimationChange(EEntityState newState)
    {
        //If using legacy animation
        if (m_animation != null)
        {
            if (newState == EEntityState.Stun)
            {
                if (m_animation.isPlaying)
                {
                    m_animation.Stop();
                }
            }

            if (OnAnimationStateChanged != null)
            {
                OnAnimationStateChanged(newState);
            }
            if (newState == EEntityState.Run)
            {
                m_animation[newState.ToString()].speed = m_animationDataDict[newState].m_animationSpeed * (1 + (m_entity.SpeedMod / 10));
                m_animation.Play(newState.ToString());
            }
            else
            {
                AnimationClip clip = m_animation.GetClip(newState.ToString());
                if (clip != null)
                {
                    m_animation[newState.ToString()].speed = m_animationDataDict[newState].m_animationSpeed;
                    m_animation.Play(newState.ToString());
                }
            }
        }

        //If using Animator
        if (m_animator != null)
        {
            if (newState == EEntityState.Stun)
            {
                m_animator.StopPlayback();
            }

            if (OnAnimationStateChanged != null)
            {
                OnAnimationStateChanged(newState);
            }
            Debug.Log("Playing animation Mecanim " + newState);

            if (newState == EEntityState.Run)
            {
                m_animator.Play(newState.ToString());
                //m_animator.speed = (1 + m_entity.SpeedMod);
            }
            else
            {
                m_animator.Play(newState.ToString());
                //m_animator.speed = 1;
            }
        }
    }
Exemple #2
0
 public void PlayAnim(EEntityState animType)
 {
     if (m_animator != null)
     {
         string animName = GetAnimNameByType(animType);
         m_animator.Play(animName);
     }
 }
Exemple #3
0
    private void CharacterAnimationRegion()
    {
        GUILayout.BeginVertical();

        GUILayout.BeginHorizontal();

        GUILayout.BeginVertical();

        GUILayout.Space(5);

        GUILayout.Label("Add Animation ", CharacterEditorWindow.m_skin.label);

        GUILayout.EndVertical();

        GUILayout.Space(5);

        GUILayout.BeginVertical();

        GUILayout.Space(8);

        m_animationOptionSelectedIndex = EditorGUILayout.Popup(m_animationOptionSelectedIndex, m_animationClipOptions);

        GUILayout.EndVertical();

        GUILayout.Space(5);

        if (GUILayout.Button(new GUIContent(""), CharacterEditorWindow.m_skin.customStyles[1], GUILayout.Width(36), GUILayout.Height(36)))
        {
            string clipName = m_animationClipOptions[m_animationOptionSelectedIndex];
            if (!m_clips.ContainsKey(clipName))
            {
                m_clips.Add(clipName, null);
                EEntityState animation = (EEntityState)Enum.Parse(typeof(EEntityState), clipName);
                if (!CharacterEditorWindow.m_activeEntityData.AnimationDataExist(animation))
                {
                    AnimationData def = new AnimationData(animation, 1);
                    CharacterEditorWindow.m_activeEntityData.AddAnimationData(def);
                }
            }
            else
            {
                Debug.LogWarning("Error trying to add an already existent clip");
            }
        }

        GUILayout.FlexibleSpace();

        GUILayout.EndHorizontal();

        List <string> clipKeys = new List <string>(m_clips.Keys);

        foreach (string activeClipName in clipKeys)
        {
            DrawAnimationClipField(activeClipName);
        }

        GUILayout.EndVertical();
    }
Exemple #4
0
 public void Jump(float speed)
 {
     if (m_state != EEntityState.Jumping)
     {
         m_rigidBody.velocity = new Vector2(m_rigidBody.velocity.x, speed);
         m_state = EEntityState.Jumping;
         PlayAnimation("Jump");
     }
 }
Exemple #5
0
    public void SwitchState(EEntityState state) {
        State = state;

        switch (State) {
            case EEntityState.DEAD:
                transform.localScale = new Vector3(0, 0, 0);
                break;
            default: break;
        }
    }
Exemple #6
0
    private void OnCollisionEnter2D(Collision2D collision)
    {
        if (m_state == EEntityState.Jumping)
        {
            m_state = EEntityState.None;
            m_rigidBody.velocity = new Vector2(m_rigidBody.velocity.x, 0);

            PlayAnimation(m_rigidBody.velocity.x != 0 ? "Run" : "Idle");
        }
    }
Exemple #7
0
 public AnimationData GetAnimationData(EEntityState animation)
 {
     foreach (AnimationData animationDef in m_animationDataList)
     {
         if (animationDef.m_animation == animation)
         {
             return(animationDef);
         }
     }
     return(null);
 }
Exemple #8
0
 public bool AnimationDataExist(EEntityState animation)
 {
     foreach (AnimationData animationDef in m_animationDataList)
     {
         if (animationDef.m_animation == animation)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #9
0
 public bool RemoveAnimationData(EEntityState animation)
 {
     for (int i = 0; i < m_animationDataList.Count; i++)
     {
         if (m_animationDataList[i].m_animation == animation)
         {
             m_animationDataList.RemoveAt(i);
             return(true);
         }
     }
     return(false);
 }
Exemple #10
0
    public void LoadAnimationData()
    {
        if (m_animation == null && m_animator == null)
        {
            return;
        }

        //Load Legacy Data
        if (m_animation != null)
        {
            if (m_animationDataDict == null)
            {
                m_animationDataDict = new Dictionary <EEntityState, AnimationData>();
                //If using Legacy
                foreach (AnimationData animationData in m_entity.EntityData.m_animationDataList)
                {
                    if (!m_animationDataDict.ContainsKey(animationData.m_animation))
                    {
                        m_animationDataDict.Add(animationData.m_animation, animationData);
                    }
                    else
                    {
                        Debug.LogError("Error: Animation Data Duplicated: " + animationData.m_animation.ToString() + " In character: " + m_entity.DataIdentifier);
                    }
                }
            }
            return;
        }

        //Load Animator Data
        if (m_animator != null)
        {
            if (m_animatorClipsDict == null)
            {
                m_animatorClipsDict = new Dictionary <EEntityState, AnimationClip>();

                foreach (AnimationClip ac in m_animator.runtimeAnimatorController.animationClips)
                {
                    EEntityState animation = (EEntityState)Enum.Parse(typeof(EEntityState), ac.name);
                    // look at all the animation clips here!
                    if (!m_animatorClipsDict.ContainsKey(animation))
                    {
                        m_animatorClipsDict.Add(animation, ac);
                    }
                    else
                    {
                        Debug.LogError("Error: Animation Data Duplicated: " + ac.name + " In character: " + m_entity.DataIdentifier);
                    }
                }
            }
        }
    }
Exemple #11
0
    private void FireBall()
    {
        if (m_anim != null)
        {
            bool         left  = CheckTargetIsLeft();
            EEntityState state = left ? EEntityState.HitFan : EEntityState.Hit;
            m_anim.PlayAnim(state);
        }

        CoroutineTool.GetInstance().StartCoroutine(StartHitBall());
//        //动画事件触发
//        HitBall();
    }
Exemple #12
0
    public float ChangeState(EEntityState newState)
    {
        //Legacy Animation
        if (m_animation != null)
        {
            if (m_currentState != newState)
            {
                if (OnAnimationStateChanged != null)
                {
                    OnAnimationStateChanged(newState);
                }
                RpcAnimationChange((int)newState, NetworkTime.Instance.ServerStep());
                m_currentState = newState;
                AnimationClip clip = m_animation.GetClip(newState.ToString());
                if (clip != null)
                {
                    return(clip.length / m_animationDataDict[newState].m_animationSpeed);
                }
                return(0);
            }
        }
        //Animator
        if (m_animator != null)
        {
            if (m_currentState != newState)
            {
                if (OnAnimationStateChanged != null)
                {
                    OnAnimationStateChanged(newState);
                }
                RpcAnimationChange((int)newState, NetworkTime.Instance.ServerStep());
                m_currentState = newState;
                m_animator.Play(newState.ToString());
                //m_animator.SetTrigger(newState.ToString());
                Debug.Log("Changing animation Trigger: " + newState);
                if (m_animatorClipsDict.ContainsKey(m_currentState))
                {
                    return(m_animatorClipsDict[newState].length / m_animator.speed);
                }
            }
        }

        return(0);
    }
Exemple #13
0
    public void Switch(EEntityState state, Vector3 recordPos)
    {
        GameStart.GetInstance().LogModuel.Log(ELogType.Normal, "Switch State : " + state.ToString());
        //播放对应动画
        if (m_characterAnim != null)
        {
            m_characterAnim.PlayAnim(state);
        }

        switch (state)
        {
        case EEntityState.Hit:
            if ((m_characterCollider != null && m_characterCollider.BallEnter) || (m_batCollider != null && m_batCollider.BallEnter))
            {
                HitBall(recordPos);
            }
            break;
        }
    }
Exemple #14
0
    public int DrawAbility(int posX, int yPos, int maxLevel, GUISkin skin)
    {
        int initPos = yPos;

#if UNITY_EDITOR
        //EditorStyles.textField.fontStyle = FontStyle.Bold;

        m_icon = (Sprite)EditorGUI.ObjectField(new Rect(posX, yPos, 70, 70), m_icon, typeof(Sprite), false);

        yPos += 70;

        m_identifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_identifier, skin.textField);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Identifier", "Ability identifier used to identity and load abilities"), skin.label);

        m_abilityName = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_abilityName, skin.textField);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Description Name: ", "Ability name to show"), skin.label);

        m_attackType = (EAttackType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_attackType);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Type: ", "Ability type"), skin.label);

        m_requiresTarget = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_requiresTarget);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Requires Target?: ", "Select this if the current ability requires targetting. The target could be a Position or Entity"), skin.label);

        m_faceTarget = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_faceTarget);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Look Target?: ", "Select this if you want the entity to face the target while casting the ability"), skin.label);

        if (m_requiresTarget)
        {
            posX += 40;

            m_targetType = (ETargetType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_targetType);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Target Type: ", "Select the type of the target that you want the ability to make effect."), skin.label);
            if (m_targetType != ETargetType.SelfTarget)
            {
                m_allegiance = (EAllegiance)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_allegiance);
                EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Target Allegiance: ", "Select the allegiance to be used by the ability to filter targets or detect collisions."), skin.label);
            }
            if (m_targetType != ETargetType.SelfTarget && m_targetType != ETargetType.AllTarget)
            {
                m_maxTargets = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_maxTargets, 1, 10);
                EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Max Targets: ", "Max targets the ability will try go cast the ability on."), skin.label);
            }
            posX -= 40;
            if (m_targetType == ETargetType.PositionTarget)
            {
                m_skillShotType = (ESkillShotType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_skillShotType);
                EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("SkillShot Type: ", "If the target type is a Position Target. \nFrontSkill: The ability will be casted from the entity to the target direction. \nFloorSkill: The ability will be casted from the floor position."), skin.label);
                if (m_skillShotType == ESkillShotType.FrontSkill)
                {
                    m_detectionRange = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 150, 20), m_detectionRange, skin.textField);
                    EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Collision Detection Range: ", "This is the distance the ability will be using to detect collisions. \nRecommended Setting: 0.3f"), skin.label);
                }
            }
            m_indicatorPrefab = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_indicatorPrefab, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Indicator Prefab: ", "This is the Indicator used to handle the gizmo logic to show the ability range, position or direction. \nDefault Values: \n-SimpleIndicator"), skin.label);
            if (m_targetType == ETargetType.PositionTarget)
            {
                m_targetImageIndicator = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_targetImageIndicator, skin.textField);
                EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Target Indicator Image: ", "This is the Target Image loaded by the Indicator. \nDefault Values: \n-SimpleFloorImage  \n-SimpleFrontImage"), skin.label);
            }
            m_rangeImageIndicator = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_rangeImageIndicator, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Range Indicator Image: ", "This is the Range Image loaded by the Indicator to show the ability Range to the player. \nDefault Values: \n-SimpleRangueImage"), skin.label);
        }
        else
        {
        }

        GUI.color = new Color(0f, .8f, .8f, 0.15f);
        //GUI.Box(new Rect(posX, initPos, 350, (yPos - initPos) + 20), "");
        GUI.color = Color.white;

        yPos += 30;


        //Casting Parameters
        m_playCastAnimation = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_playCastAnimation);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Play Cast Animation? "), skin.label);

        if (m_playCastAnimation)
        {
            posX += 40;
            m_castingAnimation = (EEntityState)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_castingAnimation);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Cast Animation: "), skin.label);

            m_castTime = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 180, 20), m_castTime, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Casting Time"), skin.label);

            m_castParticleIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_castParticleIdentifier, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Cast Particle Identifier"), skin.label);
            posX -= 40;
        }

        //Animation Parameters
        m_playAbilityAnimation = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_playAbilityAnimation);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Plays Ability Anim? ", "Mark this if the ability runs animations."), skin.label);

        if (m_playAbilityAnimation)
        {
            posX       += 40;
            m_animation = (EEntityState)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_animation);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability Animation: "), skin.label);
            posX -= 40;
        }

        if (m_playCastAnimation || m_playAbilityAnimation)
        {
            m_launchingType = (ELaunchingState)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_launchingType);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch State: "), skin.label);

            m_animationPercentLaunch = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_animationPercentLaunch, 0, 100);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Anim Percent Launch"), skin.label);
        }



        m_processor = (AbilityProcessorType)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_processor);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability processor type"), skin.label);


        switch (m_processor)
        {
        case AbilityProcessorType.DamageImpact:

            break;

        case AbilityProcessorType.LaunchAbility:
            posX += 40;
            m_projectileIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 180, 20), m_projectileIdentifier, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Projectile Prefab Identifier"), skin.label);
            m_projectileQuantity = EditorGUI.IntField(new Rect(posX + 150, yPos += 20, 180, 20), m_projectileQuantity, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Projectile Quantity"), skin.label);
            m_projectileSpeed = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 180, 20), m_projectileSpeed, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Projectile Speed"), skin.label);

            posX -= 40;
            break;

        case AbilityProcessorType.CastSideEffectsOnly:
            m_damageLogic = EDamageLogic.None;
            break;

        default:
            break;
        }
        if (m_processor != AbilityProcessorType.CastSideEffectsOnly)
        {
            m_launchPos = (EEntityTransform)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_launchPos);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Ability launch Position"), skin.label);
            m_launchParticleIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_launchParticleIdentifier, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Particle Prefab Identifier"), skin.label);
            m_launchParticlePercentLaunch = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_launchParticlePercentLaunch, 0, 100);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Particle Animation Percent"), skin.label);
            m_impactParticleIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_impactParticleIdentifier, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Impact Particle Prefab Identifier"), skin.label);
            m_launchSoundIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_launchSoundIdentifier, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Sound Identifier"), skin.label);
            m_launchSoundVolume = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_launchSoundVolume, 0, 100);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Launch Sound Volume"), skin.label);
            m_impactSoundIdentifier = EditorGUI.TextField(new Rect(posX + 150, yPos += 20, 150, 20), m_impactSoundIdentifier, skin.textField);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Impact Sound Identifier"), skin.label);
            m_impactSoundVolume = EditorGUI.IntSlider(new Rect(posX + 150, yPos += 20, 150, 20), m_impactSoundVolume, 0, 100);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Impact Sound Volume"), skin.label);
            posX         += 400;
            yPos          = 150;
            m_damageLogic = (EDamageLogic)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_damageLogic);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Damage Logic"), skin.label);
        }



        if (m_damageLogic != EDamageLogic.None)
        {
            m_canDamageTowers = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_canDamageTowers);
            EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Can Damage towers?: "), skin.label);

            if (m_damageLogic == EDamageLogic.DamageAoeLogic)
            {
                m_aoeRange = EditorGUI.FloatField(new Rect(posX + 150, yPos += 20, 180, 20), m_aoeRange);
                EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Damage Aoe Range"), skin.label);
            }
        }
        else
        {
            //Damage logic == none
        }

        int prevPosX = posX;
        m_canLevelUp = EditorGUI.Toggle(new Rect(posX + 150, yPos += 20, 150, 20), m_canLevelUp);
        EditorGUI.LabelField(new Rect(posX, yPos, 150, 20), new GUIContent("Can level up?: "), skin.label);
        if (m_canLevelUp)
        {
            while (m_abilityDamageData.Count < maxLevel)
            {
                m_abilityDamageData.Add(new AbilityDamageData());
            }
        }
        else
        {
            if (m_abilityDamageData.Count == 0)
            {
                m_abilityDamageData.Add(new AbilityDamageData());
            }
            if (m_abilityDamageData.Count > 1)
            {
                m_abilityDamageData.RemoveRange(1, m_abilityDamageData.Count - 1);
            }
        }
        yPos += 20;
        for (int i = 0; i < m_abilityDamageData.Count; i++)
        {
            if (i == 0)
            {
                EditorGUI.LabelField((new Rect(posX, yPos + 20, 180, 20)), new GUIContent("Base Damage"), skin.label);
                EditorGUI.LabelField((new Rect(posX, yPos + 40, 180, 20)), new GUIContent("Base Ability"), skin.label);
                EditorGUI.LabelField((new Rect(posX, yPos + 60, 180, 20)), new GUIContent("Range"), skin.label);
                EditorGUI.LabelField((new Rect(posX, yPos + 80, 180, 20)), new GUIContent("ColdDown"), skin.label);
                EditorGUI.LabelField((new Rect(posX, yPos + 100, 180, 20)), new GUIContent("ManaCost"), skin.label);
                posX += 100;
            }
            EditorGUI.LabelField((new Rect(posX + (50 * i), yPos, 180, 20)), new GUIContent("Lvl: " + (i + 1)), skin.label);
            m_abilityDamageData[i].BaseAdDamage = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].BaseAdDamage);
            m_abilityDamageData[i].BaseApDamage = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].BaseApDamage);
            m_abilityDamageData[i].Range        = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].Range);
            if (m_abilityDamageData[i].Range < 1)
            {
                m_abilityDamageData[i].Range = 1;
            }
            m_abilityDamageData[i].ColdDownSeconds = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].ColdDownSeconds);
            m_abilityDamageData[i].ManaCost        = EditorGUI.FloatField(new Rect(posX + (50 * i), yPos += 20, 35, 20), m_abilityDamageData[i].ManaCost);

            yPos -= 5 * 20;
        }
        posX -= 400;
        yPos += 5 * 20;
        posX  = prevPosX;
        yPos += 30;

        m_abilityDescription = EditorGUI.TextArea(new Rect(posX, yPos += 20, 300, 20 + 60), m_abilityDescription);
        yPos += 60;
        if (GUI.Button(new Rect(posX, yPos += 20, 300, 20), "Add Description Param"))
        {
            m_descriptionParamList.Add(new EDescriptionParameter());
            return(0);
        }
        for (int i = 0; i < m_descriptionParamList.Count; i++)
        {
            m_descriptionParamList[i] = (EDescriptionParameter)EditorGUI.EnumPopup(new Rect(posX + 150, yPos += 20, 150, 20), m_descriptionParamList[i]);
            EditorGUI.LabelField((new Rect(posX, yPos, 180, 20)), new GUIContent("Param Number: " + i), skin.label);
        }



        //Effects Parameters

        yPos = initPos;

        GUIStyle m_boldStyle = new GUIStyle();
        m_boldStyle.fontSize  = 18;
        m_boldStyle.fontStyle = FontStyle.Bold;
        EditorGUI.LabelField(new Rect(posX + 400, yPos - 40, 300, 20), new GUIContent("Side Effects Configuration"), skin.GetStyle("BoldText"));

        m_effectClasses = GetEffectClasses();

        m_effectClassIndex = EditorGUI.Popup(new Rect(posX + 400, yPos += 20, 300, 20), m_effectClassIndex, m_effectClasses);
        GUI.color          = Color.green;
        if (GUI.Button(new Rect(posX + 400, yPos += 20, 300, 20), "Add Side Effect"))
        {
            SideEffect effect = ScriptableObjectUtility.CreateAsset(m_effectClasses[m_effectClassIndex], Identifier);
            effect.EffectIdentifier = Identifier + "-" + m_effectClasses[m_effectClassIndex];
            m_sideEffects.Add(effect);
            AssetDatabase.SaveAssets();
            AssetDatabase.Refresh();
            return(0);
        }
        GUI.color = Color.white;
        yPos     += 30;
        for (int i = 0; i < m_sideEffects.Count; i++)
        {
            //GUI.contentColor = Color.cyan;

            EditorGUI.LabelField((new Rect(posX + 400, yPos += 20, 300, 20)), new GUIContent("Effect Type: " + m_sideEffects[i].GetType().ToString()), skin.label);


            int boxPosY = yPos;
            yPos = m_sideEffects[i].DrawEffect(posX + 400, yPos, skin);
            //GUI.color = Color.cyan;
            GUI.Box(new Rect(posX + 390, boxPosY, 8, (yPos - boxPosY) + 20), "");
            //GUI.color = Color.red;
            EditorGUI.LabelField((new Rect(posX + 400, yPos += 20, 300, 20)), new GUIContent("Remove this effect "), skin.GetStyle("RedText"));
            if (GUI.Button(new Rect(posX + 550, yPos, 20, 20), "", skin.GetStyle("RemoveButton")))
            {
                string path = AssetDatabase.GetAssetPath(m_sideEffects[i]);
                AssetDatabase.DeleteAsset(path);
                m_sideEffects.RemoveAt(i);
                break;
            }
            //    if (GUI.Button(new Rect(posX + 400, yPos += 20, 300, 20), "Remove This Effect"))
            //{
            //
            //}
            //GUI.color = Color.white;
            yPos += 20;
        }


        EditorUtility.SetDirty(this);
#endif
        return(yPos - initPos);
    }
Exemple #15
0
 private void OnEntityStateChanged(EEntityState state)
 {
     Isfinish = true;
 }
Exemple #16
0
    private void DrawAnimationClipField(string clipName)
    {
        GUILayout.BeginHorizontal();

        GUILayout.Label(clipName, CharacterEditorWindow.m_skin.label);

        GUILayout.Space(5);

        AnimationClip clipObject = (AnimationClip)EditorGUILayout.ObjectField(m_clips[clipName], typeof(AnimationClip), false);

        if (clipObject != null && clipObject != m_clips[clipName])
        {
            m_clips[clipName] = clipObject;
        }

        GUILayout.Space(5);

        if (m_clips[clipName] != null && !ClipExist(clipName))
        {
            if (GUILayout.Button("Add", CharacterEditorWindow.m_skin.button))
            {
                m_animation.AddClip(m_clips[clipName], clipName);
            }
        }
        else if (m_clips[clipName] != null && ClipExist(clipName) && !m_playingAnimation)
        {
            if (GUILayout.Button("Play", CharacterEditorWindow.m_skin.button))
            {
                m_clips[clipName]     = m_animation.GetClip(clipName);
                m_animationLength     = m_clips[clipName].length;
                m_currentTime         = 0;
                m_activeAnimationName = clipName;
                m_playingAnimation    = true;
                m_deltaTime           = EditorApplication.timeSinceStartup;
            }

            GUILayout.Space(5);

            if (GUILayout.Button("Remove", CharacterEditorWindow.m_skin.button))
            {
                m_animation.RemoveClip(m_animation.GetClip(clipName));
                m_clips.Remove(clipName);
            }
        }

        GUILayout.Space(5);

        EEntityState animation = (EEntityState)Enum.Parse(typeof(EEntityState), clipName);

        if (CharacterEditorWindow.m_activeEntityData.AnimationDataExist(animation))
        {
            AnimationData def = CharacterEditorWindow.m_activeEntityData.GetAnimationData(animation);
            GUILayout.Label(new GUIContent("Animation Speed: ", "Normal Speed = 1"), CharacterEditorWindow.m_skin.label);
            def.m_animationSpeed = EditorGUILayout.FloatField(def.m_animationSpeed, CharacterEditorWindow.m_skin.textField, GUILayout.Width(25), GUILayout.Height(20));
        }


        GUILayout.FlexibleSpace();

        GUILayout.EndHorizontal();
    }
Exemple #17
0
 public SetAnimationTask(MobaEntity entity, EEntityState animation, int time) : base(time)
 {
     m_entity    = entity;
     m_animation = animation;
 }
Exemple #18
0
    public void PlayAnim(EEntityState animType)
    {
        string animName = GetAnimNameByType(animType);

        PlayAnim(animName);
    }
Exemple #19
0
 private string GetAnimNameByType(EEntityState animType)
 {
     return(animType.ToString());
 }
Exemple #20
0
 public AnimationData(EEntityState animation, float animationSpeed)
 {
     m_animation      = animation;
     m_animationSpeed = animationSpeed;
 }