Ejemplo n.º 1
0
        public void Init(ActData.AttackDef data, IActUnit owner, string action, ISkillItem skillItem,
                         Action <HitDefinition> finishHandle)
        {
            mAttackDef    = data;
            mOwner        = owner;
            mAction       = action;
            mSkillItem    = skillItem;
            mFinishHandle = finishHandle;

            mIsFinish    = false;
            mInitPos     = owner.Position;
            mOrientation = owner.Orientation;
            mDelayTime   = mAttackDef.Delay * 0.001f;
            UpdatePosition(0);

            if (!string.IsNullOrEmpty(mAttackDef.SelfEffect))
            {
                Vector3 tmpPos = new Vector3(mAttackDef.SelfEffectOffset.X * 0.01f,
                                             mAttackDef.SelfEffectOffset.Y * 0.01f,
                                             mAttackDef.SelfEffectOffset.Z * 0.01f);

                mHitDefEffectMgr.PlayEffect(mAttackDef.SelfEffect, mAttackDef.SelfEffectDuration * 0.001f,
                                            mCacheTransform, tmpPos, mOwner.Transform.rotation);
            }
        }
Ejemplo n.º 2
0
        public void CreateHitDefinition(ActData.AttackDef data, IActUnit owner, string action, ISkillItem skillItem)
        {
            HitDefinition tmpHitDef = mHitDefPool.Spawn();

            tmpHitDef.CacheTransform.SetParent(mHitDefRoot, false);
            tmpHitDef.Init(data, owner, action, skillItem, OnFinishHandle);
            mHitDefList.Add(tmpHitDef);
        }
Ejemplo n.º 3
0
        void LashProcess(ActData.AttackDef attackDef,
                         ref HitData hitData,
                         IActUnit target,
                         ActData.HeightStatusFlag targetHeightStatus,
                         bool processLash,
                         bool rotateOnHit)
        {
            int   AttackeeStraightTime = attackDef.AttackeeStraightTime;
            float AttackeeLashX        = attackDef.AttackeeLash.X;
            float AttackeeLashY        = attackDef.AttackeeLash.Y;
            float AttackeeLashZ        = attackDef.AttackeeLash.Z;
            int   AttackeeTime         = attackDef.AttackeeTime;

            ActData.AttackDef.Types.HitResultData hitResultData = null;
            switch (targetHeightStatus)
            {
            case ActData.HeightStatusFlag.Ground:
                hitResultData = attackDef.GroundHit;
                break;

            case ActData.HeightStatusFlag.LowAir:
                hitResultData = attackDef.LowAirHit;
                break;

            case ActData.HeightStatusFlag.HighAir:
                hitResultData = attackDef.HighAirHit;
                break;
            }

            if (hitResultData != null && hitResultData.Enabled)
            {
                AttackeeLashX        = hitResultData.AttackeeLash.X;
                AttackeeLashY        = hitResultData.AttackeeLash.Y;
                AttackeeLashZ        = hitResultData.AttackeeLash.Z;
                AttackeeTime         = hitResultData.AttackeeTime;
                AttackeeStraightTime = hitResultData.AttackeeStraightTime;
            }

            if (processLash)
            {
                // 非受击转向的时候,冲击速度需要转换为本地坐标。
                if (!rotateOnHit)
                {
                    Quaternion rotate = Quaternion.AngleAxis(mOrientation * Mathf.Rad2Deg + 180, Vector3.up);
                    if (mAttackDef.FramType != ActData.HitDefnitionFramType.CuboidType)
                    {
                        Vector3 targetToOwner = mPos - target.Position;
                        targetToOwner.y = 0;
                        rotate          = Quaternion.LookRotation(targetToOwner);
                    }
                    Vector3 lashVector = rotate * new Vector3(AttackeeLashX, AttackeeLashY, AttackeeLashZ);
                    lashVector = target.UGameObject.transform.InverseTransformDirection(lashVector);

                    AttackeeLashX = (short)lashVector.x;
                    AttackeeLashZ = (short)lashVector.z;
                }

                hitData.LashX    = (short)AttackeeLashX;
                hitData.LashY    = (short)AttackeeLashY;
                hitData.LashZ    = (short)AttackeeLashZ;
                hitData.LashTime = (short)AttackeeTime;
            }

            hitData.StraightTime = (short)AttackeeStraightTime;
        }