Example #1
0
        protected void UpdateDead()
        {
            CharacterInfo charObj = GetOwner();

            if (null == charObj)
            {
                return;
            }
            if (charObj.IsDead())
            {
                if (!m_CharacterAnimationInfo.IsPlayDead)
                {
                    m_CharacterAnimationInfo.IsPlayDead = true;
                    string name = GetAnimationNameByType(Animation_Type.AT_Dead);
                    if (!string.IsNullOrEmpty(name))
                    {
                        RecordAnim(name, false);
                        GfxSystem.CrossFadeAnimation(m_Actor, name);
                    }
                }
            }
            else
            {
                if (m_CharacterAnimationInfo.IsPlayDead)
                {
                    m_CharacterAnimationInfo.IsPlayDead = false;

                    /*string name = GetAnimationNameByType(Animation_Type.AT_Dead);
                     * if (!string.IsNullOrEmpty(name)) {
                     * GfxSystem.StopAnimation(m_Actor, name);
                     * }*/
                }
            }
        }
Example #2
0
        private void FadeToHold()
        {
            string name = GetAnimationNameByType(Animation_Type.AT_Hold);

            if (!string.IsNullOrEmpty(name))
            {
                GfxSystem.CrossFadeAnimation(m_Actor, name);
            }
        }
Example #3
0
        public void PlayAnimation(Animation_Type type, float speed)
        {
            string name = GetAnimationNameByType(type);

            if (string.IsNullOrEmpty(name))
            {
                return;
            }

            GfxSystem.CrossFadeAnimation(m_Actor, name);
            GfxSystem.SetAnimationSpeed(m_Actor, name, speed);
        }
Example #4
0
        private void StartMoveAnimation()
        {
            Animation_Type type = Animation_Type.AT_None;
            float          speed_factor;
            float          move_speed = GetOwner().GetActualProperty().MoveSpeed;

            GetAnimationDirAndSpeed(m_CharacterAnimationInfo.MoveMode,
                                    m_CharacterAnimationInfo.MoveDir,
                                    move_speed, out type, out speed_factor);
            string name = GetAnimationNameByType(type);

            if (!string.IsNullOrEmpty(name))
            {
                RecordAnim(name, false);
                GfxSystem.CrossFadeAnimation(m_Actor, name, 0.05f);
                //GfxSystem.SetAnimationSpeed(m_Actor, name, (float)speed_factor);
            }
        }
Example #5
0
        protected virtual void UpdateIdle()
        {
            if (!GetOwner().IsDead() && m_CharacterAnimationInfo.IsIdle())
            {
                if (m_IdleState == IdleState.kNotIdle)
                {
                    //PlayAnimation(Animation_Type.AT_Hold);
                    string name = GetAnimationNameByType(Animation_Type.AT_Hold);
                    if (!string.IsNullOrEmpty(name))
                    {
                        GfxSystem.CrossFadeAnimation(m_Actor, name, 0.5f);
                    }

                    m_BeginIdleTime = TimeUtility.GetServerMilliseconds();
                    m_IdleState     = IdleState.kReady;
                    m_IdleInterval  = new Random().Next(1, 3) * 1000;
                }
                else if (m_IdleState == IdleState.kReady)
                {
                    if (TimeUtility.GetServerMilliseconds() - m_BeginIdleTime > m_IdleInterval)
                    {
                        string name = GetAnimationNameByType(Animation_Type.AT_Stand);
                        if (!string.IsNullOrEmpty(name))
                        {
                            GfxSystem.CrossFadeAnimation(m_Actor, name, 0.5f);
                        }
                        //PlayAnimation(Animation_Type.AT_Stand);
                        m_BeginIdleTime = TimeUtility.GetServerMilliseconds();
                    }
                }
            }
            else
            {
                m_IdleState = IdleState.kNotIdle;
            }
        }