Exemplo n.º 1
0
        public IEnumerator Test1()
        {
            LogAssert.ignoreFailingMessages = true;
            InputMessageModel inputMessageModel = new InputMessageModel()
            {
                X           = 1,
                Y           = 1,
                Angle       = float.NaN,
                TickNumber  = 0,
                UseAbility  = false,
                TickTimeSec = 0
            };
            float     deltaTimeSec = 1f;
            Transform goTransform  = playerEntity.view.gameObject.transform;

            for (int i = 0; i < 50; i++)
            {
                Vector3 startPosition = goTransform.position;
                playerPredictor.Predict(playerEntity.id.value, inputMessageModel, deltaTimeSec);
                Vector3 finalPosition = goTransform.position;
                float   delta         = (finalPosition - startPosition).magnitude;
                string  message       = $"startPosition = {startPosition.x} {startPosition.y} {startPosition.z} | " +
                                        $"finishPosition = {finalPosition.x} {finalPosition.y} {finalPosition.z} " +
                                        $"delta = {delta}";
                Debug.LogWarning(message);
                Assert.IsTrue(delta > 0.01f);
            }

            yield return(null);
        }
 public void Execute()
 {
     try
     {
         ushort            playerEntityId    = PlayerIdStorage.PlayerEntityId;
         float             deltaTime         = Time.deltaTime;
         InputMessageModel inputMessageModel = clientInputMessagesHistory.GetLast();
         //тик
         playerPredictor.Predict(playerEntityId, inputMessageModel, deltaTime);
     }
     catch (Exception e)
     {
         log.Error(e.FullMessage());
     }
 }