public override void Process(Action _action, Track _track, int _localTime)
        {
            if (!this.actorTarget)
            {
                return;
            }
            int num = _localTime - this.lastTime;

            this.lastTime = _localTime;
            if (this.actorTarget.get_handle().ActorControl.curMoveCommand != null)
            {
                FrameCommand <MoveDirectionCommand> frameCommand = (FrameCommand <MoveDirectionCommand>) this.actorTarget.get_handle().ActorControl.curMoveCommand;
                VInt3 vInt  = this.actorTarget.get_handle().forward;
                VInt3 right = VInt3.right;
                this.destDir = right.RotateY((int)frameCommand.cmdData.Degree);
                if (this.destDir != vInt)
                {
                    this.bNeedRotate  = true;
                    this.curRotateSpd = this.rotateSpeed;
                    int num2 = this.destDir.x * vInt.z - vInt.x * this.destDir.z;
                    if (num2 == 0)
                    {
                        int num3 = VInt3.Dot(this.destDir, vInt);
                        if (num3 >= 0)
                        {
                            return;
                        }
                        this.curRotateSpd = this.rotateSpeed;
                    }
                    else if (num2 < 0)
                    {
                        this.curRotateSpd = -this.rotateSpeed;
                    }
                    VFactor vFactor  = VInt3.AngleInt(this.destDir, vInt);
                    VFactor vFactor2 = VFactor.pi * (long)num * (long)this.curRotateSpd / 180L / 1000L;
                    if (vFactor <= vFactor2)
                    {
                        vInt             = vInt.RotateY(ref vFactor);
                        this.bNeedRotate = false;
                    }
                    else
                    {
                        vInt = vInt.RotateY(ref vFactor2);
                    }
                    this.actorTarget.get_handle().MovementComponent.SetRotate(vInt, true);
                }
            }
            else
            {
                this.destDir      = this.actorTarget.get_handle().forward;
                this.bNeedRotate  = false;
                this.curRotateSpd = 0;
            }
            base.Process(_action, _track, _localTime);
        }
    public override void UpdateShape(VInt3 location, VInt3 forward)
    {
        VCollisionSphere.UpdatePosition(ref this.worldPos, ref this.localPos, ref location, ref forward);
        if (this.rotation != 0)
        {
            forward = forward.RotateY(this.rotation);
        }
        VFactor vFactor;
        VFactor vFactor2;

        IntMath.sincos(out vFactor, out vFactor2, (long)(314 * Mathf.Clamp(this.degree, 1, 360)), 36000L);
        long num  = vFactor2.nom * vFactor.den;
        long num2 = vFactor2.den * vFactor.nom;
        long b    = vFactor2.den * vFactor.den;

        this.rightDir.x = (int)IntMath.Divide((long)forward.x * num + (long)forward.z * num2, b);
        this.rightDir.z = (int)IntMath.Divide((long)(-(long)forward.x) * num2 + (long)forward.z * num, b);
        this.rightDir.y = 0;
        num2            = -num2;
        this.leftDir.x  = (int)IntMath.Divide((long)forward.x * num + (long)forward.z * num2, b);
        this.leftDir.z  = (int)IntMath.Divide((long)(-(long)forward.x) * num2 + (long)forward.z * num, b);
        this.leftDir.y  = 0;
        this.rightDir.Normalize();
        this.leftDir.Normalize();
        this.dirty = false;
    }
示例#3
0
 public void UseSkillCacheMove(PoolObjHandle <ActorRoot> _actorRoot, int _deltaTime, int _moveSpeed)
 {
     if (!_actorRoot)
     {
         return;
     }
     if (this.cacheMoveCommand != null && !this.cacheMoveExpire && this.cacheMoveCommand.cmdType == 131)
     {
         FrameCommand <MoveDirectionCommand> frameCommand = (FrameCommand <MoveDirectionCommand>) this.cacheMoveCommand;
         if (!_actorRoot.get_handle().ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_Move))
         {
             VInt3 right   = VInt3.right;
             VInt3 vInt    = right.RotateY((int)frameCommand.cmdData.Degree).NormalizeTo(_moveSpeed * _deltaTime / 1000);
             VInt  groundY = _actorRoot.get_handle().groundY;
             vInt = PathfindingUtility.Move(_actorRoot.get_handle(), vInt, out groundY, out _actorRoot.get_handle().hasReachedNavEdge, null);
             if (_actorRoot.get_handle().MovementComponent.isFlying)
             {
                 int y = _actorRoot.get_handle().location.y;
                 _actorRoot.get_handle().location += vInt;
                 VInt3 location = _actorRoot.get_handle().location;
                 location.y = y;
                 _actorRoot.get_handle().location = location;
             }
             else
             {
                 _actorRoot.get_handle().location += vInt;
             }
             _actorRoot.get_handle().groundY = groundY;
         }
     }
 }
示例#4
0
 public void UseSkillCacheLerpMove(PoolObjHandle <ActorRoot> _actorRoot, int _deltaTime, int _moveSpeed)
 {
     if (!_actorRoot)
     {
         return;
     }
     if (this.cacheMoveCommand != null && !this.cacheMoveExpire && this.cacheMoveCommand.cmdType == 131)
     {
         FrameCommand <MoveDirectionCommand> frameCommand = (FrameCommand <MoveDirectionCommand>) this.cacheMoveCommand;
         if (!_actorRoot.get_handle().ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_Move))
         {
             VInt3 vInt = VInt3.right;
             vInt = vInt.RotateY((int)frameCommand.cmdData.Degree);
             Vector3 position = _actorRoot.get_handle().myTransform.position;
             VInt3   vInt2    = vInt.NormalizeTo(_moveSpeed * _deltaTime / 1000);
             VInt    vInt3    = 0;
             vInt2 = PathfindingUtility.MoveLerp(_actorRoot, (VInt3)position, vInt2, out vInt3);
             if (_actorRoot.get_handle().MovementComponent.isFlying)
             {
                 float y = position.y;
                 _actorRoot.get_handle().myTransform.position += (Vector3)vInt2;
                 Vector3 position2 = _actorRoot.get_handle().myTransform.position;
                 position2.y = y;
                 _actorRoot.get_handle().myTransform.position = position2;
             }
             else
             {
                 _actorRoot.get_handle().myTransform.position += (Vector3)vInt2;
             }
         }
     }
 }
        public void ExecCommand(IFrameCommand cmd)
        {
            Player player = Singleton <GamePlayerCenter> .GetInstance().GetPlayer(cmd.playerID);

            if (player != null && player.Captain)
            {
                SkillUseParam skillUseParam = default(SkillUseParam);
                VInt3         inVec         = VInt3.right;
                inVec = inVec.RotateY((int)this.Degree);
                skillUseParam.Init(this.SlotType, inVec, false, this.dwObjectID);
                player.Captain.get_handle().ActorControl.CmdUseSkill(cmd, ref skillUseParam);
            }
        }
示例#6
0
        public void UseSkillCache(PoolObjHandle <ActorRoot> _actorRoot)
        {
            if (!_actorRoot)
            {
                return;
            }
            if (!this.cacheSkillExpire)
            {
                if (!this.bCacheCommonAttack)
                {
                    SkillSlot skillSlot = _actorRoot.get_handle().SkillControl.GetSkillSlot(this.cacheSkillParam.SlotType);
                    if (skillSlot != null && skillSlot.IsEnableSkillSlot())
                    {
                        this.cacheSkillCommand.frameNum = Singleton <FrameSynchr> .GetInstance().CurFrameNum;

                        _actorRoot.get_handle().ActorControl.CmdUseSkill(this.cacheSkillCommand, ref this.cacheSkillParam);
                    }
                }
                else
                {
                    _actorRoot.get_handle().ActorControl.CacheNoramlAttack(this.cacheSkillCommand, SkillSlotType.SLOT_SKILL_0);
                }
                this.cacheSkillExpire = true;
            }
            if (this.cacheMoveCommand != null && !this.cacheRotateExpire)
            {
                if (this.cacheMoveCommand.cmdType == 131)
                {
                    FrameCommand <MoveDirectionCommand> frameCommand = (FrameCommand <MoveDirectionCommand>) this.cacheMoveCommand;
                    if (!_actorRoot.get_handle().ActorControl.GetNoAbilityFlag(ObjAbilityType.ObjAbility_MoveRotate))
                    {
                        VInt3 vInt = VInt3.right;
                        vInt = vInt.RotateY((int)frameCommand.cmdData.Degree);
                        _actorRoot.get_handle().MovementComponent.SetRotate(vInt, true);
                        Quaternion rotation = Quaternion.identity;
                        rotation = Quaternion.LookRotation((Vector3)vInt);
                        _actorRoot.get_handle().rotation = rotation;
                    }
                }
                this.cacheRotateExpire = true;
            }
        }
示例#7
0
 public void Enter(Action _action)
 {
     this.skillContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
     this.lastTime     = 0;
     this.lastVelocity = (this.lastLerpVelocity = this.velocity);
     this.stopCondtion = false;
     this.moveActor    = _action.GetActorHandle(this.targetId);
     if (!this.moveActor)
     {
         return;
     }
     this.gravityControler = new AccelerateMotionControler();
     this.moveActor.get_handle().ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
     if (this.MoveType == ActorMoveType.Target)
     {
         this.tarActor = _action.GetActorHandle(this.destId);
         if (!this.tarActor)
         {
             return;
         }
         this.destPosition = this.tarActor.get_handle().location;
         CActorInfo charInfo = this.tarActor.get_handle().CharInfo;
         if (charInfo != null)
         {
             this.hitHeight = charInfo.iBulletHeight;
             VInt3 vInt = this.moveActor.get_handle().location - this.destPosition;
             vInt.y             = 0;
             vInt               = vInt.NormalizeTo(1000);
             this.destPosition += IntMath.Divide(vInt, (long)charInfo.iCollisionSize.x, 1000L);
         }
         this.destPosition.y = this.destPosition.y + this.hitHeight;
     }
     else if (this.MoveType == ActorMoveType.Directional)
     {
         VInt3 vInt2 = VInt3.one;
         if (this.skillContext == null)
         {
             return;
         }
         PoolObjHandle <ActorRoot> originator = this.skillContext.Originator;
         if (!originator)
         {
             return;
         }
         if (this.bBulletUseDir)
         {
             _action.refParams.GetRefParam("_BulletUseDir", ref vInt2);
         }
         else if (this.bUseIndicatorDir)
         {
             SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
             VInt3           vInt3;
             if (refParamObject != null && refParamObject.CalcAttackerDir(out vInt3, originator))
             {
                 vInt2 = vInt3;
             }
             else
             {
                 vInt2 = originator.get_handle().forward;
             }
         }
         else
         {
             vInt2 = originator.get_handle().forward;
         }
         vInt2 = vInt2.RotateY(this.offsetDir.y);
         if (this.bResetMoveDistance)
         {
             int num = 0;
             _action.refParams.GetRefParam("_BulletRealFlyingTime", ref num);
             int num2 = num * this.velocity / 1000;
             this.distance = ((num2 <= 0) ? this.distance : num2);
         }
         this.destPosition   = this.moveActor.get_handle().location + vInt2.NormalizeTo(this.distance);
         this.destPosition.y = this.moveActor.get_handle().location.y;
     }
     else if (this.MoveType == ActorMoveType.Position)
     {
         if (this.bReachDestStop)
         {
             this.destPosition = this.targetPosition;
         }
         else
         {
             VInt3 vInt4 = this.targetPosition - this.moveActor.get_handle().location;
             vInt4.y           = 0;
             vInt4             = vInt4.NormalizeTo(1000);
             this.destPosition = this.moveActor.get_handle().location + vInt4 * (this.length * this.velocity / 1000);
             VInt vInt5;
             if (PathfindingUtility.GetGroundY(this.destPosition, out vInt5))
             {
                 this.destPosition.y = vInt5.i;
             }
         }
     }
     if (this.bAdjustSpeed)
     {
         VInt3 vInt6 = this.destPosition - this.moveActor.get_handle().location;
         int   num3  = this.length - 100;
         num3          = ((num3 > 0) ? num3 : this.length);
         this.velocity = (int)IntMath.Divide((long)vInt6.get_magnitude2D() * 1000L, (long)num3);
     }
     if (this.gravity < 0)
     {
         if (this.velocity == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt3 vInt7 = this.destPosition - this.moveActor.get_handle().location;
         int   num4;
         if (!this.shouldUseAcceleration)
         {
             num4 = (int)IntMath.Divide((long)vInt7.get_magnitude2D() * 1000L, (long)this.velocity);
         }
         else
         {
             long num5 = (long)this.velocity;
             long num6 = (long)this.acceleration;
             long num7 = (long)vInt7.get_magnitude2D();
             long num8 = num5 * num5 + 2L * num6 * num7;
             num4 = (int)IntMath.Divide(((long)IntMath.Sqrt(num8) - num5) * 1000L, num6);
             this.lastVelocity = (this.lastLerpVelocity = this.velocity);
         }
         if (num4 == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt vInt8;
         if (PathfindingUtility.GetGroundY(this.destPosition, out vInt8))
         {
             this.gravityControler.InitMotionControler(num4, vInt8.i - this.moveActor.get_handle().location.y, this.gravity);
         }
         else
         {
             this.gravityControler.InitMotionControler(num4, 0, this.gravity);
         }
     }
 }
 public void Enter(Action _action)
 {
     this.skillContext = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
     this.lastTime     = 0;
     this.lastVelocity = (this.lastLerpVelocity = this.velocity);
     this.stopCondtion = false;
     this.moveActor    = _action.GetActorHandle(this.targetId);
     if (!this.moveActor)
     {
         return;
     }
     this.gravityControler = new AccelerateMotionControler();
     this.xControler       = new xAxisAccelerateMotionControler();
     this.moveActor.handle.ObjLinker.AddCustomMoveLerp(new CustomMoveLerpFunc(this.ActionMoveLerp));
     if (this.MoveType == ActorMoveType.Target)
     {
         if (this.bFindTargetByRotateBodyBullet)
         {
             _action.refParams.GetRefParam("FindEnemyActor", ref this.tarActor);
         }
         else
         {
             this.tarActor = _action.GetActorHandle(this.destId);
         }
         if (!this.tarActor)
         {
             return;
         }
         this.destPosition = this.tarActor.handle.location;
         CActorInfo charInfo = this.tarActor.handle.CharInfo;
         if (charInfo != null)
         {
             this.hitHeight = charInfo.iBulletHeight;
             VInt3 a = this.moveActor.handle.location - this.destPosition;
             a.y = 0;
             a   = a.NormalizeTo(1000);
             this.destPosition += IntMath.Divide(a, (long)charInfo.iCollisionSize.x, 1000L);
         }
         this.destPosition.y = this.destPosition.y + this.hitHeight;
     }
     else if (this.MoveType == ActorMoveType.Directional)
     {
         VInt3 vInt = VInt3.one;
         if (this.skillContext == null)
         {
             return;
         }
         PoolObjHandle <ActorRoot> originator = this.skillContext.Originator;
         if (!originator)
         {
             return;
         }
         if (this.bBulletUseDir)
         {
             _action.refParams.GetRefParam("_BulletUseDir", ref vInt);
         }
         else if (this.bUseIndicatorDir)
         {
             SkillUseContext refParamObject = _action.refParams.GetRefParamObject <SkillUseContext>("SkillContext");
             VInt3           vInt2;
             if (refParamObject != null && refParamObject.CalcAttackerDir(out vInt2, originator))
             {
                 vInt = vInt2;
             }
             else
             {
                 vInt = originator.handle.forward;
             }
         }
         else
         {
             vInt = originator.handle.forward;
         }
         this.moveActor.handle.forward  = vInt;
         this.moveActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt);
         vInt = vInt.RotateY(this.offsetDir.y);
         if (this.bResetMoveDistance)
         {
             int num = 0;
             _action.refParams.GetRefParam("_BulletRealFlyingTime", ref num);
             int num2 = num * this.velocity / 1000;
             this.distance = ((num2 > 0) ? num2 : this.distance);
         }
         this.destPosition   = this.moveActor.handle.location + vInt.NormalizeTo(this.distance);
         this.destPosition.y = this.moveActor.handle.location.y;
     }
     else if (this.MoveType == ActorMoveType.Position)
     {
         if (this.bReachDestStop)
         {
             this.destPosition = this.targetPosition;
         }
         else
         {
             VInt3 lhs = this.targetPosition - this.moveActor.handle.location;
             lhs.y             = 0;
             lhs               = lhs.NormalizeTo(1000);
             this.destPosition = this.moveActor.handle.location + lhs * (this.length * this.velocity / 1000);
             VInt vInt3;
             if (PathfindingUtility.GetGroundY(this.destPosition, out vInt3))
             {
                 this.destPosition.y = vInt3.i;
             }
         }
     }
     else if (this.MoveType == ActorMoveType.RotateBody)
     {
         this.originateActor = this.skillContext.Originator;
         if (!this.originateActor)
         {
             DebugHelper.Assert(false, "产生子弹的originateActor不能为空!!!");
             return;
         }
         this.rotateBodyBulletCount       = Mathf.Clamp(this.rotateBodyBulletCount, 1, 360);
         this.rotateBodyCurDirDegreeAngle = 360 / this.rotateBodyBulletCount * this.skillContext.BulletPos.x;
         VInt3 vInt4 = this.moveActor.handle.forward.RotateY(-this.rotateBodyCurDirDegreeAngle);
         this.moveActor.handle.forward  = vInt4;
         this.moveActor.handle.rotation = Quaternion.LookRotation((Vector3)vInt4);
     }
     if (this.bAdjustSpeed)
     {
         VInt3 vInt5 = this.destPosition - this.moveActor.handle.location;
         int   num3  = this.length - 100;
         num3          = ((num3 <= 0) ? this.length : num3);
         this.velocity = (int)IntMath.Divide((long)vInt5.magnitude2D * 1000L, (long)num3);
     }
     if (this.gravity < 0)
     {
         if (this.velocity == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt3 vInt6 = this.destPosition - this.moveActor.handle.location;
         int   num4;
         if (!this.shouldUseAcceleration)
         {
             num4 = (int)IntMath.Divide((long)vInt6.magnitude2D * 1000L, (long)this.velocity);
         }
         else
         {
             long num5 = (long)this.velocity;
             long num6 = (long)this.acceleration;
             long num7 = (long)vInt6.magnitude2D;
             long a2   = num5 * num5 + 2L * num6 * num7;
             num4 = (int)IntMath.Divide(((long)IntMath.Sqrt(a2) - num5) * 1000L, num6);
             this.lastVelocity = (this.lastLerpVelocity = this.velocity);
         }
         if (num4 == 0)
         {
             this.stopCondtion = true;
             return;
         }
         VInt vInt7;
         if (PathfindingUtility.GetGroundY(this.destPosition, out vInt7))
         {
             this.gravityControler.InitMotionControler(num4, vInt7.i - this.moveActor.handle.location.y, this.gravity);
         }
         else
         {
             this.gravityControler.InitMotionControler(num4, 0, this.gravity);
         }
     }
     if (this.bMoveOnXAxis)
     {
         this.zDirection   = this.destPosition - this.moveActor.handle.location;
         this.xDirection   = VInt3.Cross(VInt3.up, this.zDirection);
         this.zCurPosition = this.moveActor.handle.location;
         if (this.bReachDestStop)
         {
             int[]   array  = new int[3];
             VInt3[] array2 = new VInt3[]
             {
                 default(VInt3),
                 default(VInt3),
                 this.destPosition - this.moveActor.handle.location
             };
             array2[0] = array2[2];
             array2[1] = array2[2];
             array2[0].NormalizeTo(this.distanceZ0);
             array2[1].NormalizeTo(this.distanceZ1);
             for (int i = 0; i < array.Length; i++)
             {
                 if (!this.shouldUseAcceleration)
                 {
                     array[i] = (int)IntMath.Divide((long)array2[i].magnitude2D * 1000L, (long)this.velocity);
                 }
                 else
                 {
                     long num8  = (long)this.velocity;
                     long num9  = (long)this.acceleration;
                     long num10 = (long)array2[i].magnitude2D;
                     long a3    = num8 * num8 + 2L * num9 * num10;
                     array[i] = (int)IntMath.Divide(((long)IntMath.Sqrt(a3) - num8) * 1000L, num9);
                 }
             }
             if (array[2] > array[1] && array[1] > array[0] && array[0] > 0)
             {
                 this.xControler.InitMotionControler(array[0], array[1], array[2], this.distanceZ0, this.distanceZ1, this.distanceX);
                 int desPostion = this.xControler.getDesPostion();
                 this.xDestPosition = this.xDirection;
                 this.xDestPosition.NormalizeTo(Math.Abs(desPostion));
                 if (desPostion < 0)
                 {
                     this.xDestPosition = -this.xDestPosition;
                 }
             }
             else
             {
                 this.bMoveOnXAxis = false;
             }
         }
     }
 }