private void GameEvents_onCharacterMoved(UserMovement data)
 {
     if (!_activePlayers.ContainsKey(data.UserId))
     {
         return;
     }
     _activePlayers[data.UserId].Movement.MoveAndRotate(data);
 }
Esempio n. 2
0
        //on remote client
        public void MoveAndRotate(UserMovement newMovement)
        {
            //_animator.SetFloat("moveSpeed", (transform.position - newMovement.Position).magnitude);
            _lastRealPosition = _realPosition;
            _lastRealRotation = _realRotation;
            _realPosition     = newMovement.Position;
            _realRotation     = newMovement.Angle;
            _timeToLerp       = newMovement.Time;

            if (_realPosition != transform.position)
            {
                _isLerpingPosition = true;
            }

            if (_realRotation.eulerAngles != transform.rotation.eulerAngles)
            {
                _isLerpingRotation = true;
            }

            _timeStartedLerping = Time.time;
        }
Esempio n. 3
0
 private void OnMoveCharacter(UserMovement direction)
 {
     _manager.Socket.Emit("move_character", direction);
 }
Esempio n. 4
0
 internal static void CharacterMoved(UserMovement direction)
 {
     onCharacterMoved?.Invoke(direction);
 }