示例#1
0
    private void ClientUpdatePosition()
    {
        if (PendingMoveList.Count > 0)
        {
            // CurrentReplayTime = PendingMoveList[0].timestamp;

            for (int i = 0; i < PendingMoveList.Count; i++)
            {
                // Debug.Log("Coreecting " + (i+1) + "/" + PendingMoveList.Count + " adustement timestamp " + latestAdjustment.TimeStamp + " | " + PendingMoveList[i].timestamp);
                if (latestAdjustment.TimeStamp > PendingMoveList[i].timestamp)
                {
                }
                else if (latestAdjustment.TimeStamp == PendingMoveList[i].timestamp)
                {
                    controller.enabled            = false;
                    controller.transform.position = latestAdjustment.getNewLoc();
                    controller.enabled            = true;

                    transform.position = latestAdjustment.getNewLoc();
                    transform.rotation = Quaternion.Euler(new Vector3(0, latestAdjustment.NewRot, 0));

                    Debug.Log("This is Start " + transform.position);
                }
                else if (latestAdjustment.TimeStamp < PendingMoveList[i].timestamp)
                {
                    PendingMoveList[i].setStartPostion(transform.position);
                    PendingMoveList[i].startRotationAngle = transform.rotation.eulerAngles.y;

                    PerformeMovment(PendingMoveList[i], Time.deltaTime);

                    PendingMoveList[i].setPostion(transform.position);
                    PendingMoveList[i].rotationAngle = transform.rotation.eulerAngles.y;

                    Debug.Log("Moves from " + PendingMoveList[i].getStartPostion() + " to " + PendingMoveList[i].getPostion() + " direction " + PendingMoveList[i].getDirection());

                    //smoothing
                }
            }
        }
        bUpdatePosition = false;
    }
示例#2
0
    void ClientAdjustPosition(ClientAdjustment adjustment)
    {
        if (botColor == BotColor.Green && photonView.IsMine)
        {
            if (adjustment.AckGoodMove)
            {
                if (PendingMoveList != null)
                {
                    PendingMoveList.RemoveAll(a => a.timestamp <= adjustment.TimeStamp);
                }
            }
            else
            {
                bUpdatePosition = true;

                latestAdjustment = adjustment;
                Debug.Log(" WRONMG move " + adjustment.getStartLoc() + " resulted in postion " + adjustment.getNewLoc() + " actual postion   " + transform.position + "  on " + adjustment.TimeStamp);
            }
        }
    }