コード例 #1
0
    public AnimationClip GetAnim(AnimDirectionType animDirectionType, AnimAttackType animAttackType)
    {
        int directionType = EnumHelper.GetIndex <AnimDirectionType>(animDirectionType);
        int attackType    = EnumHelper.GetIndex <AnimAttackType>(animAttackType);

        return(animations[TOTAL_DIRECTION_TYPES * attackType + directionType]);
    }
コード例 #2
0
 public void UpdateAnimator(AnimatorOverrideController animator, AnimAttackType animAttackType)
 {
     foreach (AnimDirectionType directionType in Enum.GetValues(typeof(AnimDirectionType)))
     {
         animator[directionType.ToString()] = GetAnim(directionType, animAttackType);
     }
 }
コード例 #3
0
 void ClearAnimator(AnimatorOverrideController animator, AnimAttackType animAttackType)
 {
     foreach (AnimDirectionType directionType in Enum.GetValues(typeof(AnimDirectionType)))
     {
         animator[directionType.ToString()] = null;
     }
 }
コード例 #4
0
    public void Equip(AnimGroup animGroup, AnimAttackType animAttackType, Color color)
    {
        float flashAmount = color.a;
        Color flashColor  = new Color(color.r, color.g, color.b, 1f);

        m_spriteRenderer.material.SetFloat("_FlashAmount", flashAmount);
        m_spriteRenderer.material.SetColor("_FlashColor", flashColor);
        m_spriteRenderer.material.SetColor("_Color", m_tintColor);
        m_spriteRenderer.color  = Color.white;
        m_spriteRenderer.sprite = null;

        m_animGroup      = animGroup;
        m_animAttackType = animAttackType;
        m_animColor      = color;

        if (m_animGroup != null)
        {
            float   spriteHeight = m_animGroup.GetSpriteHeight();
            Vector3 pos          = transform.localPosition;
            pos.y = -Mathf.Max((spriteHeight - 1.5f) / 2, 0f);
            transform.localPosition = pos;

            animGroup.UpdateAnimator(m_animatorOverrideController, m_animAttackType);
        }
        else
        {
            ClearAnimator(m_animatorOverrideController, m_animAttackType);
        }
    }
コード例 #5
0
 void SetPlayerPoseEnum(AnimAttackType attackType)
 {
     m_attackType = attackType;
     foreach (GearSocket gear in gearSockets)
     {
         gear.SetAttackType(attackType);
     }
 }
コード例 #6
0
    public void SetAttackType(AnimAttackType animAttackType)
    {
        m_animAttackType = animAttackType;

        if (m_animGroup != null)
        {
            m_animGroup.UpdateAnimator(m_animatorOverrideController, m_animAttackType);
        }
    }
コード例 #7
0
    public void AddAnim(int animationId, AnimDirectionType animDirectionType, AnimAttackType animAttackType)
    {
        if (animAttackType.Equals(AnimAttackType.Unknown))  // Unknown
        {
            return;
        }
        int           directionType = EnumHelper.GetIndex <AnimDirectionType>(animDirectionType);
        int           attackType    = EnumHelper.GetIndex <AnimAttackType>(animAttackType);
        string        separator     = Path.DirectorySeparatorChar.ToString();
        AnimationClip anim          = Resources.Load <AnimationClip>("Animations" + separator + animationId);

        animations[TOTAL_DIRECTION_TYPES * attackType + directionType] = anim;
        UpdateAnimationClipSpriteSize(anim);
    }
コード例 #8
0
ファイル: Avatar.cs プロジェクト: jerhemy/EQBrowser
        void Start()
        {
            m_controller    = this.GetComponentInChildren <CharacterController>();
            m_curState      = AnimStates.Idle;
            m_animComponent = this.gameObject.GetComponentInChildren <Animation>();

            m_isDead    = false;
            m_isSitting = false;

            for (int i = 0; i < (int)AnimationType.DEFAULT; i++)
            {
                m_animComponent.AddClip(characterAnimations[i], ((AnimationType)i).ToString());
            }

            m_animComponent.Play(characterAnimations[(int)AnimationType.Idle].name);

            m_animComponent.wrapMode = WrapMode.Loop;

            m_attackType = AnimAttackType.None;
            m_turnDir    = TurningType.None;
        }
コード例 #9
0
ファイル: Avatar.cs プロジェクト: jerhemy/EQBrowser
        void ProcessTestAnimationKeyPresses()
        {
            m_attackType = AnimAttackType.None;

            bool shift = Input.GetKey(KeyCode.LeftShift);
            bool ctrl  = Input.GetKey(KeyCode.LeftControl);

            if (shift)
            {
                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    m_attackType        = AnimAttackType.CastBuff;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    m_attackType        = AnimAttackType.CastDamage;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    m_attackType        = AnimAttackType.CastHeal;
                    m_curAnimTransition = AnimTransitions.Attack;
                }

                if (Input.GetKeyDown(KeyCode.C))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isSitting)
                        {
                            m_curAnimTransition = AnimTransitions.SittingDown;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.StandingUp;
                        }
                        m_isSitting = !m_isSitting;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.X))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isDead)
                        {
                            m_curAnimTransition = AnimTransitions.Dying;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.UnDying;
                        }
                        m_isDead = !m_isDead;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.V))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isCrouching)
                        {
                            m_curAnimTransition = AnimTransitions.DuckingDown;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.DuckingUp;
                        }
                        m_isCrouching = !m_isCrouching;
                    }
                }
            }
            //NOTE: Since Unity uses CTRL + KEY in the editor, these will not work
            else if (ctrl)
            {
                if (Input.GetKeyDown(KeyCode.C))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isSitting)
                        {
                            m_curAnimTransition = AnimTransitions.SittingDown;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.StandingUp;
                        }
                        m_isSitting = !m_isSitting;
                    }
                }
            }
            else
            {
                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    m_attackType        = AnimAttackType.M1H;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    m_attackType        = AnimAttackType.MOH;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    m_attackType        = AnimAttackType.M1HP;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha4))
                {
                    m_attackType        = AnimAttackType.M2HB;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha5))
                {
                    m_attackType        = AnimAttackType.M2HS;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha6))
                {
                    m_attackType        = AnimAttackType.MDragonPunch;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha7))
                {
                    m_attackType        = AnimAttackType.MEagleStrike;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha8))
                {
                    m_attackType        = AnimAttackType.MKick;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha9))
                {
                    m_attackType        = AnimAttackType.MKickFlying;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha0))
                {
                    m_attackType        = AnimAttackType.MKickRound;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Minus))
                {
                    m_attackType        = AnimAttackType.MRanged;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
            }
        }
コード例 #10
0
ファイル: Avatar.cs プロジェクト: uNetti/EQBrowser
        void Start()
        {
            m_controller = this.GetComponentInChildren<CharacterController>();
            m_curState = AnimStates.Idle;
            m_animComponent = this.gameObject.GetComponentInChildren<Animation>();

            m_isDead = false;
            m_isSitting = false;

            for (int i = 0; i < (int)AnimationType.DEFAULT; i++)
            {
                m_animComponent.AddClip(characterAnimations[i], ((AnimationType)i).ToString());
            }

            m_animComponent.Play(characterAnimations[(int)AnimationType.Idle].name);

            m_animComponent.wrapMode = WrapMode.Loop;

            m_attackType = AnimAttackType.None;
            m_turnDir = TurningType.None;
        }
コード例 #11
0
ファイル: Avatar.cs プロジェクト: uNetti/EQBrowser
        void ProcessTestAnimationKeyPresses()
        {
            m_attackType = AnimAttackType.None;

            bool shift = Input.GetKey(KeyCode.LeftShift);
            bool ctrl = Input.GetKey(KeyCode.LeftControl);

            if (shift)
            {
                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    m_attackType = AnimAttackType.CastBuff;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    m_attackType = AnimAttackType.CastDamage;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    m_attackType = AnimAttackType.CastHeal;
                    m_curAnimTransition = AnimTransitions.Attack;
                }

                if (Input.GetKeyDown(KeyCode.C))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isSitting)
                        {
                            m_curAnimTransition = AnimTransitions.SittingDown;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.StandingUp;
                        }
                        m_isSitting = !m_isSitting;

                    }
                }
                else if (Input.GetKeyDown(KeyCode.X))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isDead)
                        {
                            m_curAnimTransition = AnimTransitions.Dying;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.UnDying;
                        }
                        m_isDead = !m_isDead;
                    }
                }
                else if (Input.GetKeyDown(KeyCode.V))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isCrouching)
                        {
                            m_curAnimTransition = AnimTransitions.DuckingDown;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.DuckingUp;
                        }
                        m_isCrouching = !m_isCrouching;
                    }
                }
            }
                //NOTE: Since Unity uses CTRL + KEY in the editor, these will not work
            else if (ctrl)
            {
                if (Input.GetKeyDown(KeyCode.C))
                {
                    if (m_curAnimTransition == AnimTransitions.None)
                    {
                        if (!m_isSitting)
                        {
                            m_curAnimTransition = AnimTransitions.SittingDown;
                        }
                        else
                        {
                            m_curAnimTransition = AnimTransitions.StandingUp;
                        }
                        m_isSitting = !m_isSitting;

                    }
                }
            }
            else
            {
                if (Input.GetKeyDown(KeyCode.Alpha1))
                {
                    m_attackType = AnimAttackType.M1H;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha2))
                {
                    m_attackType = AnimAttackType.MOH;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha3))
                {
                    m_attackType = AnimAttackType.M1HP;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha4))
                {
                    m_attackType = AnimAttackType.M2HB;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha5))
                {
                    m_attackType = AnimAttackType.M2HS;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha6))
                {
                    m_attackType = AnimAttackType.MDragonPunch;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha7))
                {
                    m_attackType = AnimAttackType.MEagleStrike;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha8))
                {
                    m_attackType = AnimAttackType.MKick;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha9))
                {
                    m_attackType = AnimAttackType.MKickFlying;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Alpha0))
                {
                    m_attackType = AnimAttackType.MKickRound;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
                else if (Input.GetKeyDown(KeyCode.Minus))
                {
                    m_attackType = AnimAttackType.MRanged;
                    m_curAnimTransition = AnimTransitions.Attack;
                }
            }
        }
コード例 #12
0
 public void Equip(AnimGroup animGroup, AnimAttackType animAttackType)
 {
     Equip(animGroup, animAttackType, m_animColor);
 }