コード例 #1
0
        public override void StartImpact(ImpactLogicInfo logicInfo)
        {
            GeneralStartImpact(logicInfo);
            SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_AddBit, GfxCharacterState_Type.HitFly);
            float        crossFadeTime = UnityEngine.Mathf.Abs(logicInfo.Velocity.y / m_Gravity);
            HitFlyParams param         = GetHitFlyParams(logicInfo);

            param.ImpactState  = HitFlyState.Rising;
            param.OnGroundTime = logicInfo.ConfigData.OnGroundTime;
            if (logicInfo.ConfigData.FallDownTime > 0)
            {
                param.FallDownTime  = logicInfo.ConfigData.FallDownTime;
                param.FallDownSpeed = GetAnimationLenthByType(logicInfo.Target, Animation_Type.AT_FlyDownGround) / param.FallDownTime;
            }
            else
            {
                param.FallDownTime  = GetAnimationLenthByType(logicInfo.Target, Animation_Type.AT_FlyDownGround);
                param.FallDownSpeed = 1.0f;
            }
            if (logicInfo.ConfigData.GetUpTime > 0)
            {
                param.GetUpTime  = logicInfo.ConfigData.GetUpTime;
                param.GetUpSpeed = GetAnimationLenthByType(logicInfo.Target, Animation_Type.AT_GetUp1) / param.GetUpTime;
            }
            else
            {
                param.GetUpTime  = GetAnimationLenthByType(logicInfo.Target, Animation_Type.AT_GetUp1);
                param.GetUpSpeed = 1.0f;
            }
            if (crossFadeTime < m_MinCrossfadeTime)
            {
                crossFadeTime = m_MinCrossfadeTime;
            }
            CrossFadeAnimation(logicInfo.Target, Animation_Type.AT_FlyUp, crossFadeTime);
        }
コード例 #2
0
        protected void GeneralStopImpact(ImpactLogicInfo logicInfo)
        {
            if (IsLogicDead(logicInfo.Target))
            {
                SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.Stiffness);
                SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.HitFly);
                SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.GetUp);
            }
            else
            {
                ClearGfxStateFlag(logicInfo.Target);
            }
            logicInfo.CustomDatas.Clear();
            //foreach=>for
            for (int i = 0; i < logicInfo.EffectsDelWithImpact.Count; ++i)
            {
                GameObject Obj = logicInfo.EffectsDelWithImpact[i];
                ResourceSystem.RecycleObject(Obj);
            }

            //foreach(GameObject obj in logicInfo.EffectsDelWithImpact){
            //  ResourceSystem.RecycleObject(obj);
            //}
            ResetLayer(logicInfo.Target, logicInfo);
            LogicSystem.NotifyGfxAnimationFinish(logicInfo.Target, false);
            LogicSystem.NotifyGfxMoveControlFinish(logicInfo.Target, logicInfo.ImpactId, false);
            LogicSystem.NotifyGfxStopImpact(logicInfo.Sender, logicInfo.ImpactId, logicInfo.Target);
        }
コード例 #3
0
        public override bool OnOtherImpact(int logicId, ImpactLogicInfo logicInfo, bool isSameImpact)
        {
            switch (logicId)
            {
            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default:
                return(false);

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_HitFly:
                StopImpact(logicInfo);
                return(true);

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_KnockDown:
                if (!isSameImpact)
                {
                    StopImpact(logicInfo);
                }
                return(true);

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Stiffness:
                return(false);

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Grab:
                StopImpact(logicInfo);
                return(true);

            default:
                return(false);
            }
        }
コード例 #4
0
        private int GetStiffnessAction(ImpactLogicInfo logicInfo)
        {
            int type        = 0;
            int actionCount = logicInfo.ConfigData.ActionList.Count;

            //foreach (int i in logicInfo.ConfigData.ActionList) {
            //}
            if (null != logicInfo && actionCount > 0)
            {
                type = logicInfo.ConfigData.ActionList[UnityEngine.Random.Range(0, actionCount)];
            }
            else
            {
            }
            switch (type)
            {
            case (int)StiffnessAction.HURT_FRONT:
                return((int)Animation_Type.AT_Hurt0);

            case (int)StiffnessAction.HURT_RIGHT:
                return((int)Animation_Type.AT_Hurt1);

            case (int)StiffnessAction.HURT_LEFT:
                return((int)Animation_Type.AT_Hurt2);

            default:
                return((int)Animation_Type.AT_Hurt0);
            }
        }
コード例 #5
0
        protected override void UpdateMovement(ImpactLogicInfo info, float deltaTime)
        {
            ///////////// temp code,禁止某些受击带来的位置突变
            bool bNoMovement = false;

            if (info.ConfigData.ParamNum == 4 && info.ConfigData.ExtraParams[3] == "456")
            {
                bNoMovement = true;
            }


            if (!bNoMovement)
            {
                if (null != info.ConfigData && null != info.Target)
                {
                    float speedRate            = GetLockFrameRate(info, Time.time - info.StartTime);
                    UnityEngine.Vector3 motion = info.MoveDir * info.MovementInfo.GetSpeedByTime(info.ElapsedTimeForEffect) * deltaTime * speedRate;
                    info.NormalPos += motion;
                    motion          = GfxImpactSystem.Instance.GetAdjustPoint(info.NormalPos - info.OrignalPos, info) + info.OrignalPos - info.Target.transform.position;
                    UnityEngine.Vector3 pos = info.Target.transform.position + motion;
                    pos = new UnityEngine.Vector3(pos.x, GetTerrainHeight(pos), pos.z);
                    MoveTo(info.Target, pos);
                    LogicSystem.NotifyGfxUpdatePosition(info.Target, info.Target.transform.position.x, info.Target.transform.position.y, info.Target.transform.position.z, 0, info.Target.transform.rotation.eulerAngles.y * UnityEngine.Mathf.PI / 180f, 0);
                }
            }
        }
コード例 #6
0
 protected void GeneralStartImpact(ImpactLogicInfo logicInfo)
 {
     InitLayer(logicInfo.Target, logicInfo);
     LogicSystem.NotifyGfxAnimationStart(logicInfo.Target, false);
     LogicSystem.NotifyGfxMoveControlStart(logicInfo.Target, logicInfo.ImpactId, false);
     InitMovement(logicInfo);
 }
コード例 #7
0
        protected void InitMovement(ImpactLogicInfo info)
        {
            ImpactLogicData config = info.ConfigData;

            if (null != config)
            {
                switch ((ImpactMovementType)config.MoveMode)
                {
                case ImpactMovementType.SenderDir:
                    if (null != info.Sender)
                    {
                        info.MoveDir = UnityEngine.Quaternion.Euler(0, ImpactUtility.RadianToDegree(info.ImpactSrcDir), 0);
                    }
                    break;

                case ImpactMovementType.SenderToTarget:
                    if (null != info.Target)
                    {
                        UnityEngine.Vector3 direction = info.Target.transform.position - info.ImpactSrcPos;
                        direction.y = 0.0f;
                        direction.Normalize();
                        info.MoveDir = UnityEngine.Quaternion.LookRotation(direction);
                    }
                    break;

                case ImpactMovementType.Inherit:
                    if (null != info.Sender)
                    {
                        info.MoveDir = UnityEngine.Quaternion.Euler(0, ImpactUtility.RadianToDegree(info.ImpactSrcDir), 0);
                    }
                    break;
                }
            }
        }
コード例 #8
0
        public virtual void UpdateEffect(ImpactLogicInfo logicInfo)
        {
            if (null == logicInfo.Target)
            {
                return;
            }
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo && !shareInfo.AcceptStiffEffect)
            {
                return;
            }
            for (int i = 0; i < logicInfo.EffectList.Count; ++i)
            {
                EffectInfo effectInfo = logicInfo.EffectList[i];
                if (null != effectInfo)
                {
                    if (effectInfo.StartTime < 0 && Time.time > logicInfo.StartTime + effectInfo.DelayTime / 1000)
                    {
                        effectInfo.IsActive  = true;
                        effectInfo.StartTime = Time.time;
                        GameObject obj = ResourceSystem.NewObject(effectInfo.Path, effectInfo.PlayTime / 1000) as GameObject;
                        if (null != obj)
                        {
                            if (effectInfo.DelWithImpact)
                            {
                                logicInfo.EffectsDelWithImpact.Add(obj);
                            }
                            if (String.IsNullOrEmpty(effectInfo.MountPoint))
                            {
                                obj.transform.position = logicInfo.Target.transform.position + effectInfo.RelativePoint;
                                UnityEngine.Quaternion q = UnityEngine.Quaternion.Euler(effectInfo.RelativeRotation.x, effectInfo.RelativeRotation.y, effectInfo.RelativeRotation.z);
                                if (effectInfo.RotateWithTarget && null != logicInfo.Sender)
                                {
                                    obj.transform.rotation = UnityEngine.Quaternion.LookRotation(logicInfo.Target.transform.position - logicInfo.Sender.transform.position, UnityEngine.Vector3.up);
                                    obj.transform.rotation = UnityEngine.Quaternion.Euler(obj.transform.rotation.eulerAngles + effectInfo.RelativeRotation);
                                }
                                else
                                {
                                    obj.transform.rotation = q;
                                }
                            }
                            else
                            {
                                Transform parent = LogicSystem.FindChildRecursive(logicInfo.Target.transform, effectInfo.MountPoint);
                                if (null != parent)
                                {
                                    obj.transform.parent        = parent;
                                    obj.transform.localPosition = UnityEngine.Vector3.zero;
                                    UnityEngine.Quaternion q = UnityEngine.Quaternion.Euler(ImpactUtility.RadianToDegree(effectInfo.RelativeRotation.x), ImpactUtility.RadianToDegree(effectInfo.RelativeRotation.y), ImpactUtility.RadianToDegree(effectInfo.RelativeRotation.z));
                                    obj.transform.localRotation = q;
                                }
                            }
                        }
                    }
                }
            }
        }
コード例 #9
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);
        }
コード例 #10
0
        public override void StartImpact(ImpactLogicInfo logicInfo)
        {
            LogicSystem.NotifyGfxAnimationStart(logicInfo.Target, false);
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            PlayAnimation(logicInfo.Target, Animation_Type.AT_Grab);
            LogicSystem.NotifyGfxMoveControlStart(logicInfo.Target, logicInfo.ImpactId, false);
            SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_AddBit, GfxCharacterState_Type.Grab);
        }
コード例 #11
0
 public override void StopImpact(ImpactLogicInfo logicInfo)
 {
     if (IsLogicDead(logicInfo.Target))
     {
         //SetGfxDead(logicInfo.Target, true);
     }
     logicInfo.IsActive = false;
     GeneralStopImpact(logicInfo);
 }
コード例 #12
0
        private HitFlyParams GetHitFlyParams(ImpactLogicInfo logicInfo)
        {
            HitFlyParams result = logicInfo.CustomDatas.GetData <HitFlyParams>();

            if (null == result)
            {
                result = new HitFlyParams();
                logicInfo.CustomDatas.AddData <HitFlyParams>(result);
            }
            return(result);
        }
コード例 #13
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);
        }
コード例 #14
0
        public override void StartImpact(ImpactLogicInfo logicInfo)
        {
            GeneralStartImpact(logicInfo);
            logicInfo.ActionType = GetStiffnessAction(logicInfo);
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo)
            {
                shareInfo.GfxStateFlag = shareInfo.GfxStateFlag | (int)GfxCharacterState_Type.Stiffness;
            }
            PlayAnimation(logicInfo.Target, (Animation_Type)logicInfo.ActionType);
        }
コード例 #15
0
        public override void OnInterrupted(ImpactLogicInfo logicInfo)
        {
            StopAnimation(logicInfo.Target, (Animation_Type)logicInfo.ActionType);
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo)
            {
                shareInfo.GfxStateFlag = shareInfo.GfxStateFlag & ~((int)GfxCharacterState_Type.Stiffness);
            }
            logicInfo.IsActive = false;
            GeneralStopImpact(logicInfo);
        }
コード例 #16
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();
            }
        }
コード例 #17
0
 public void Reset()
 {
     for (int i = m_ImpactLogicInfos.Count - 1; i >= 0; --i)
     {
         ImpactLogicInfo info = m_ImpactLogicInfos[i];
         if (null != info)
         {
             info.Recycle();
             m_ImpactLogicInfos.RemoveAt(i);
         }
     }
     m_ImpactLogicInfos.Clear();
 }
コード例 #18
0
        public override void StopImpact(ImpactLogicInfo logicInfo)
        {
            for (int i = 0; i < logicInfo.EffectsDelWithImpact.Count; i++)
            {
                ResourceSystem.RecycleObject(logicInfo.EffectsDelWithImpact[i]);
            }

            /*
             * foreach(GameObject obj in logicInfo.EffectsDelWithImpact){
             * ResourceSystem.RecycleObject(obj);
             * }*/
            logicInfo.IsActive = false;
        }
コード例 #19
0
 public override void StopImpact(ImpactLogicInfo logicInfo)
 {
     logicInfo.IsActive = false;
     StopAnimation(logicInfo.Target, Animation_Type.AT_Grab);
     if (null != logicInfo.Target)
     {
         UnityEngine.Vector3 rotation = logicInfo.Target.transform.rotation.eulerAngles;
         logicInfo.Target.transform.rotation = UnityEngine.Quaternion.Euler(0, rotation.y, 0);
     }
     SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.Grab);
     LogicSystem.NotifyGfxMoveControlFinish(logicInfo.Target, logicInfo.ImpactId, false);
     LogicSystem.NotifyGfxAnimationFinish(logicInfo.Target, false);
     LogicSystem.NotifyGfxStopImpact(logicInfo.Sender, logicInfo.ImpactId, logicInfo.Target);
 }
コード例 #20
0
 protected override void UpdateMovement(ImpactLogicInfo info, float deltaTime)
 {
     if (null != info.ConfigData && null != info.Target)
     {
         info.Velocity = info.MoveDir * info.MovementInfo.GetSpeedByTime(Time.time - info.StartTime);
         UnityEngine.Vector3 motion = info.Velocity * deltaTime;
         info.NormalPos += motion;
         motion          = GfxImpactSystem.Instance.GetAdjustPoint(info.NormalPos - info.OrignalPos, info) + info.OrignalPos - info.Target.transform.position;
         UnityEngine.Vector3 pos = info.Target.transform.position + motion;
         pos = new UnityEngine.Vector3(pos.x, GetTerrainHeight(pos), pos.z);
         MoveTo(info.Target, pos);
         LogicSystem.NotifyGfxUpdatePosition(info.Target, info.Target.transform.position.x, info.Target.transform.position.y, info.Target.transform.position.z, 0, info.Target.transform.rotation.eulerAngles.y * UnityEngine.Mathf.PI / 180f, 0);
     }
 }
コード例 #21
0
 public virtual void OnInterrupted(ImpactLogicInfo logicInfo)
 {
     if (IsLogicDead(logicInfo.Target))
     {
         SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.Stiffness);
         SetGfxStateFlag(logicInfo.Target, Operate_Type.OT_RemoveBit, GfxCharacterState_Type.HitFly);
     }
     else
     {
         ClearGfxStateFlag(logicInfo.Target);
     }
     ResetLayer(logicInfo.Target, logicInfo);
     LogicSystem.NotifyGfxAnimationFinish(logicInfo.Target, false);
     LogicSystem.NotifyGfxMoveControlFinish(logicInfo.Target, logicInfo.ImpactId, false);
 }
コード例 #22
0
        public void StopGfxImpact(int objId, int impactId)
        {
            GameObject obj = LogicSystem.GetGameObject(objId);

            if (null != obj)
            {
                ImpactLogicInfo info = GetImpactInfoById(objId, impactId);
                if (null != info && info.IsActive)
                {
                    IGfxImpactLogic logic = GfxImpactLogicManager.Instance.GetGfxImpactLogic(info.LogicId);
                    logic.OnInterrupted(info);
                    info.IsActive = false;
                }
            }
        }
コード例 #23
0
        public override void StopImpact(ImpactLogicInfo logicInfo)
        {
            if (IsLogicDead(logicInfo.Target))
            {
                //SetGfxDead(logicInfo.Target, true);
            }
            SharedGameObjectInfo shareInfo = LogicSystem.GetSharedGameObjectInfo(logicInfo.Target);

            if (null != shareInfo)
            {
                shareInfo.GfxStateFlag = shareInfo.GfxStateFlag & ~((int)GfxCharacterState_Type.Stiffness);
            }
            logicInfo.IsActive = false;
            GeneralStopImpact(logicInfo);
        }
コード例 #24
0
 public override void Tick(ImpactLogicInfo logicInfo)
 {
     try
     {
         Profiler.BeginSample("GfxImpactLogic_Default.Tick");
         UpdateEffect(logicInfo);
         if (Time.time > logicInfo.StartTime + logicInfo.Duration)
         {
             StopImpact(logicInfo);
         }
     }
     finally
     {
         Profiler.EndSample();
     }
 }
コード例 #25
0
        public override bool OnOtherImpact(int logicId, ImpactLogicInfo logicInfo, bool isSameImpact)
        {
            HitFlyParams param  = GetHitFlyParams(logicInfo);
            bool         result = false;

            switch (logicId)
            {
            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default:
                break;

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_HitFly:
                if (HitFlyState.Falling == param.ImpactState || HitFlyState.Rising == param.ImpactState)
                {
                    PlayAnimation(logicInfo.Target, Animation_Type.AT_Hurt0, 1.0f, UnityEngine.AnimationBlendMode.Additive);
                }
                if (!isSameImpact)
                {
                    StopImpact(logicInfo);
                }
                else
                {
                }
                result = true;
                break;

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_KnockDown:
                break;

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Stiffness:
                if (HitFlyState.StandUp == param.ImpactState)
                {
                    StopImpact(logicInfo);
                    result = true;
                }
                else if (HitFlyState.Falling == param.ImpactState || HitFlyState.Rising == param.ImpactState)
                {
                    PlayAnimation(logicInfo.Target, Animation_Type.AT_Hurt0, 1.0f, UnityEngine.AnimationBlendMode.Additive);
                }
                break;

            case (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Grab:
                StopImpact(logicInfo);
                result = true;
                break;
            }
            return(result);
        }
コード例 #26
0
 private void AddImpactInfo(ImpactLogicInfo addInfo)
 {
     for (int i = m_ImpactLogicInfos.Count - 1; i >= 0; --i)
     {
         ImpactLogicInfo info = m_ImpactLogicInfos[i];
         if (null != info && null != info.Target && null != addInfo && null != addInfo.Target)
         {
             if (info.Target.GetInstanceID() == addInfo.Target.GetInstanceID() && addInfo.ImpactId == info.ImpactId)
             {
                 if (info.LogicId == (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default || addInfo.LogicId == (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default)
                 {
                     info.Recycle();
                     m_ImpactLogicInfos.RemoveAt(i);
                 }
             }
         }
     }
     m_ImpactLogicInfos.Add(addInfo);
 }
コード例 #27
0
 public void Tick()
 {
     try
     {
         Profiler.BeginSample("GfxImpactSystem.Tick");
         for (int i = m_ImpactLogicInfos.Count - 1; i >= 0; --i)
         {
             ImpactLogicInfo info = m_ImpactLogicInfos[i];
             if (null != info)
             {
                 if (info.IsActive)
                 {
                     IGfxImpactLogic logic = GfxImpactLogicManager.Instance.GetGfxImpactLogic(info.LogicId);
                     if (null != logic)
                     {
                         if (null != info.Target)
                         {
                             if (info.Target.activeSelf)
                             {
                                 logic.Tick(info);
                             }
                             else
                             {
                                 info.Recycle();
                                 m_ImpactLogicInfos.RemoveAt(i);
                             }
                         }
                     }
                 }
                 else
                 {
                     info.Recycle();
                     m_ImpactLogicInfos.RemoveAt(i);
                 }
             }
         }
         GfxImpactSoundManager.Instacne.UpdateSoundInfos();
     }
     finally
     {
         Profiler.EndSample();
     }
 }
コード例 #28
0
 public override void Tick(ImpactLogicInfo logicInfo)
 {
     try
     {
         Profiler.BeginSample("GfxImpactLogic_Grab.Tick");
         UpdateEffect(logicInfo);
         string animName = GetAnimationNameByType(logicInfo.Target, Animation_Type.AT_Grab);
         if (null != logicInfo.Target)
         {
             if (!logicInfo.Target.GetComponent <Animation>().IsPlaying(animName))
             {
                 PlayAnimation(logicInfo.Target, Animation_Type.AT_Grab);
             }
         }
     }
     finally
     {
         Profiler.EndSample();
     }
 }
コード例 #29
0
        public void SendDeadImpact(int targetId)
        {
            GameObject targetObj = LogicSystem.GetGameObject(targetId);

            if (null != targetObj)
            {
                bool needSendImpact        = true;
                UnityEngine.Vector3 srcPos = UnityEngine.Vector3.zero;
                float srcDir = 0.0f;
                for (int i = m_ImpactLogicInfos.Count - 1; i >= 0; --i)
                {
                    ImpactLogicInfo info = m_ImpactLogicInfos[i];
                    if (null != info)
                    {
                        if (info.IsActive)
                        {
                            if (info.Target.GetInstanceID() == targetObj.GetInstanceID())
                            {
                                if (info.LogicId != (int)GfxImpactLogicManager.GfxImpactLogicId.GfxImpactLogic_Default)
                                {
                                    IGfxImpactLogic logic = GfxImpactLogicManager.Instance.GetGfxImpactLogic(info.LogicId);
                                    if (null != logic)
                                    {
                                        logic.OnInterrupted(info);
                                    }
                                    needSendImpact = true;
                                    srcDir         = info.ImpactSrcDir;
                                    srcPos         = info.ImpactSrcPos;
                                    info.Recycle();
                                    m_ImpactLogicInfos.RemoveAt(i);
                                }
                            }
                        }
                    }
                }
                if (needSendImpact)
                {
                    SendImpactToCharacterImpl(targetObj, targetObj, m_DeadImpactId, srcPos.x, srcPos.y, srcPos.z, srcDir, -1);
                }
            }
        }
コード例 #30
0
 public override void Tick(ImpactLogicInfo logicInfo)
 {
     try
     {
         Profiler.BeginSample("GfxImpactLogic_Stiffness.Tick");
         float animSpeed = GetAnimationSpeedByTime(logicInfo, Time.time - logicInfo.StartTime);
         UpdateMovement(logicInfo, Time.deltaTime);
         SetAnimationSpeed(logicInfo.Target, (Animation_Type)logicInfo.ActionType, animSpeed);
         UpdateEffect(logicInfo);
         logicInfo.ElapsedTime          += Time.deltaTime * animSpeed;
         logicInfo.ElapsedTimeForEffect += Time.deltaTime * GetLockFrameRate(logicInfo, Time.time - logicInfo.StartTime);
         if (logicInfo.ElapsedTime > GetAnimationLenthByType(logicInfo.Target, (Animation_Type)logicInfo.ActionType))
         {
             StopImpact(logicInfo);
         }
     }
     finally
     {
         Profiler.EndSample();
     }
 }