void UpdateUI_LocalPlayer()
    {
        if (UI_tPing != null && netGM_Local != null)
        {
            UI_tPing.text = "Ping: " + netGM_Local.GetPing().ToString();
        }
        if (UI_tTime != null && netGM_Local != null)
        {
            UI_tTime.text = "Time on Server: " + (netGM_Local.GetServerTime());
        }

        if (UI_tTime != null)
        {
            UI_tTail.text = "Tail: " + player.GetComponent <PlayerControl_Client>()._scrinsTransformPlayer.Count.ToString();
        }
        if (UI_tLoosePocket != null)
        {
            UI_tLoosePocket.text = "Loose pocket: " + player.GetComponent <PlayerControl_Client>().tickDel.ToString();
        }
        if (UI_tHealth != null)
        {
            UI_tHealth.text = "Health: " + player.GetComponent <PlayerNetwork>().health.ToString();
        }
    }
예제 #2
0
	void Update()
	{
		if(isServer)
            return;

        if(objNetGM_Local == null)
            objNetGM_Local = GameObject.Find("GM_local_main");

        if(objNetGM_Local != null && netGM_Local == null)
            netGM_Local = objNetGM_Local.GetComponent<NetGM_Local>();

        if(objNetGM_Local != null && playerControl_LocalClient == null)
            playerControl_LocalClient = objNetGM_Local.GetComponent<PlayerControl_LocalClient>();


        if (masterClient == false && netGM_Local != null)
		{	
			tick++;
			Count = _scrinsTransformPlayer.Count;

            
              if(netGM_Local.GetServerTime() - 0.1f > (timer + 0.1f))
                  flagJourney = true;

            /*
           if(Count>0)
               if(_scrinsTransformPlayer[0].time > timer + 0.19f && _scrinsTransformPlayer[0].time < timer+0.11f)
                   flagJourney = true;
            */
            // Эстраполяция

            if (flagJourney == true && extr == 0)
			{   

				    endPosition = (endPosition - startMarker_Position) + endPosition;

                
                startMarker_Position = transform.position;
                numScr++;

                
                if (!localPlayer)
                {
                    endRotation = Quaternion.Slerp(startMarker_Rotation, endRotation, 2);
                    startMarker_Rotation = transform.rotation;
                }


                tickDel++;

                startTime = Time.time;
                extr = 1;
                flagJourney = false;
			}
 
            if (_scrinsTransformPlayer.Count > 0)
			{
                if (netGM_Local.GetServerTime() - 0.1f >= _scrinsTransformPlayer[0].time)
                {
                    startMarker_Position = transform.position;
                    endPosition = _scrinsTransformPlayer[0].position;

                    if(!localPlayer)
                    {
                        startMarker_Rotation = transform.rotation;
                        endRotation = _scrinsTransformPlayer[0].rotation;
                    }



                    startTime = Time.time;

                    numScr = _scrinsTransformPlayer[0].number;
                    timer = _scrinsTransformPlayer[0].time;
                    _scrinsTransformPlayer.RemoveAt(0);

                    extr = 0;
                }
                
            }

                prec = ((Time.time) - startTime) / (0.05f - restOfTime);
            /*
            if(prec > 1.2 && extr == 0)
            {
                extr = 1;
                numScr++;
                tickDel++;
            }
            /*
            if (true)
            {
                if (prec > 1)
                {
                     restOfTime = (Time.time - startTime) - (0.05f - restOfTime);
                     restOfTime = 0;
                     //prec = 1;

                }
                else
                {
                    restOfTime = 0;
                }
            }

            */

            if (!localPlayer)
            {
                transform.position = Vector3.Lerp(startMarker_Position, endPosition, prec);
                transform.rotation = Quaternion.Slerp(startMarker_Rotation, endRotation, prec);

            }
            else
                if (playerControl_LocalClient.moveV == false && playerControl_LocalClient.moveH == false)
                {
                    transform.position = Vector3.Lerp(startMarker_Position, endPosition, prec);
                }

        }
	
	}