Esempio n. 1
0
        public UserCmd GenerateUserCmd(IUserCmdOwnAdapter player, int intverval)
        {
            UpdateLookAt(player, _userCmdProvider.LookAt);


            if (_userCmdProvider.HasPath)
            {
                var vel = player.PlayerTransform.InverseTransformVector(_userCmdProvider.DesirwdVelocity);

                vel.y = 0;
                vel   = vel.normalized;
                _userCmd.MoveVertical   = vel.z;
                _userCmd.MoveHorizontal = vel.x;



                if (_userCmd.DeltaYaw > 1)
                {
                    _userCmd.IsSlightWalk = true;
                }
                else if (_userCmdProvider.DesirwdVelocity.magnitude > 2)
                {
                    _userCmd.IsRun = true;
                }
                else if (_userCmdProvider.DesirwdVelocity.magnitude > 0.5)
                {
                }
                else
                {
                    _userCmd.IsSlightWalk = true;
                }
            }

            _userCmd.IsCrouch     = _userCmdProvider.IsCrouch;
            _userCmd.IsJump       = _userCmdProvider.IsJump;
            _userCmd.IsProne      = _userCmdProvider.IsProne;
            _userCmd.IsPeekLeft   = _userCmdProvider.IsPeekLeft;
            _userCmd.IsPeekRight  = _userCmdProvider.IsPeekRight;
            _userCmd.IsF          = _userCmdProvider.IsF;
            _userCmd.IsLeftAttack = _userCmdProvider.IsLeftAttack;
            _userCmd.IsReload     = _userCmdProvider.IsReload;


            //_userCmdProvider.Reset();
//            _userCmdProvider.LookAt = Quaternion.Euler(0,0,
//                 0);
            _userCmd.FrameInterval = intverval;
            _userCmd.Seq           = _seq++;
            var rc = UserCmd.Allocate();

            _userCmd.CopyTo(rc);
            _userCmd.Reset();
            return(rc);
        }
Esempio n. 2
0
        public UserCmd GenerateUserCmd(IUserCmdOwnAdapter player, int intverval)
        {
            _userCmd.Seq           = _seq++;
            _userCmd.FrameInterval = intverval;
            _userCmd.ChangedSeat   = ChangeSeat();
            _userCmd.ChangeChannel = ChangeChannel();
            var rc = UserCmd.Allocate();

            _userCmd.CopyTo(rc);
            _userCmd.Reset();
            return(rc);
        }
        public UserCmd GenerateUserCmd(IUserCmdOwnAdapter player, int intverval)
        {
            logger.DebugFormat("GenerateUserCmd:{0}", MyGameTime.seq);
            userCmd.Seq           = MyGameTime.seq;
            userCmd.FrameInterval = intverval;
            userCmd.ChangedSeat   = ChangeSeat();
            userCmd.ChangeChannel = ChangeChannel();
            var rc = UserCmd.Allocate();

            userCmd.CopyTo(rc);
            userCmd.Reset();
            return(rc);
        }