예제 #1
0
        public override void StartImpact(ImpactLogicInfo logicInfo)
        {
            GeneralStartImpact(logicInfo);
            SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_AddBit, GfxCharacterState_Type.KnockDown);
            KnockDownParams param = GetKnockDownParams(logicInfo);

            param.ImpactState = KnockDownState.Falling;
            CrossFadeAnimation(logicInfo.Target, Animation_Type.AT_FlyDown);
        }
예제 #2
0
        private KnockDownParams GetKnockDownParams(ImpactLogicInfo logicInfo)
        {
            KnockDownParams result = logicInfo.CustomDatas.GetData <KnockDownParams>();

            if (null == result)
            {
                result = new KnockDownParams();
                logicInfo.CustomDatas.AddData <KnockDownParams>(result);
            }
            return(result);
        }
예제 #3
0
        public override void Tick(ImpactLogicInfo logicInfo)
        {
            try
            {
                Profiler.BeginSample("GfxImpactLogic_KnockDown.Tick");
                UpdateMovement(logicInfo, Time.deltaTime);
                UpdateEffect(logicInfo);
                GameObject      target = logicInfo.Target;
                KnockDownParams param  = GetKnockDownParams(logicInfo);
                switch (param.ImpactState)
                {
                case KnockDownState.Falling:
                    if (Time.time > logicInfo.StartTime + m_FallDownTime)
                    {
                        // 落地尘土
                        param.ImpactState   = KnockDownState.OnGround;
                        param.HitGroundTime = Time.time;
                        PlayAnimation(target, Animation_Type.AT_FlyDownGround);
                    }
                    break;

                case KnockDownState.OnGround:
                    if (IsLogicDead(target))
                    {
                        SetGfxDead(target, true);
                        CrossFadeAnimation(target, Animation_Type.AT_OnGround);
                        StopImpact(logicInfo);
                    }
                    if (Time.time > param.HitGroundTime + GetAnimationLenthByType(target, Animation_Type.AT_FlyDownGround) + logicInfo.ConfigData.OnGroundTime)
                    {
                        // 倒地时间
                        SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.KnockDown);
                        SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_AddBit, GfxCharacterState_Type.GetUp);
                        PlayAnimation(target, Animation_Type.AT_GetUp1);
                        param.ImpactState = KnockDownState.StandUp;
                    }
                    break;

                case KnockDownState.StandUp:
                    if (Time.time > param.HitGroundTime + GetAnimationLenthByType(target, Animation_Type.AT_FlyDownGround) + logicInfo.ConfigData.OnGroundTime + GetAnimationLenthByType(target, Animation_Type.AT_GetUp1))
                    {
                        SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.GetUp);
                        StopImpact(logicInfo);
                    }
                    break;
                }
            }
            finally
            {
                Profiler.EndSample();
            }
        }